Initial checkin of Spark Open Source
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4456 b35dd754-fafc-0310-a699-88a17e54d16e
396
build/build.xml
Normal file
@ -0,0 +1,396 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Spark" default="jar" basedir=".">
|
||||
|
||||
<!-- Optional add this file to override any of the properties below -->
|
||||
<property file="${basedir}/build.properties"/>
|
||||
<property name="version.major" value="1"/>
|
||||
<property name="version.minor" value="1"/>
|
||||
<property name="version.revision" value="4"/>
|
||||
|
||||
<property name="version.period" value="${version.major}.${version.minor}.${version.revision}"/>
|
||||
<property name="version.underscore" value="${version.major}_${version.minor}_${version.revision}"/>
|
||||
|
||||
<description>Jive Spark Build</description>
|
||||
<!--set global properties for this build-->
|
||||
<property name="src" location="../src/java"/>
|
||||
<property name="lib.dir" location="./lib"/>
|
||||
<property name="dist.libs.dir" location="./lib/dist"/>
|
||||
<property name="merge.libs.dir" location="./lib/merge"/>
|
||||
<property name="libs.windows.dir" location="${dist.libs.dir}/windows"/>
|
||||
<property name="libs.linux.dir" location="${dist.libs.dir}/linux"/>
|
||||
<property name="target" location="../target"/>
|
||||
<property name="classes" location="${target}/classes"/>
|
||||
<property name="target.build" location="${target}/build"/>
|
||||
<property name="sparkplugs.build" location="${target}/sparkplugs"/>
|
||||
<property name="target.resources" location="${target.build}/resources"/>
|
||||
<property name="targetlib" location="${target.build}/lib"/>
|
||||
<property name="targetlogs" location="${target.build}/logs"/>
|
||||
<property name="targetdocs" location="${target.build}/documentation"/>
|
||||
<property name="targetdocsapi" location="${targetdocs}/api"/>
|
||||
<property name="plugins" location="${target.build}/plugins"/>
|
||||
<property name="bin" location="${target.build}/bin"/>
|
||||
<property name="resources.dir" location="../src/resources"/>
|
||||
|
||||
<!-- Installer Ant Script -->
|
||||
|
||||
<property name="installer.dest.dir" value="${target}/installer"/>
|
||||
<property name="installer.install4j.srcfile" value="installer/spark.install4j"/>
|
||||
<property name="installer.app_name" value="Spark"/>
|
||||
<property name="installer.app_short_name" value="Spark"/>
|
||||
<property name="installer.product_name" value="Spark"/>
|
||||
<property name="installer.publisher" value="Jive Software"/>
|
||||
<property name="installer.publisher_url" value="www.jivesoftware.com"/>
|
||||
<property name="installer.file_prefix" value="${installer.app_short_name}"/>
|
||||
<property name="installer.release_root_path" value="${target.build}"/>
|
||||
|
||||
<property name="mac.build.dir" value="${target}/Spark_${version.underscore}"/>
|
||||
<property name="mac.app.file" value="${mac.build.dir}/Spark.app"/>
|
||||
<property name="mac.dmg.file" value="${target}/Spark_${version.underscore}.dmg"/>
|
||||
|
||||
<!-- Define Default Library Archives -->
|
||||
<path id="agent.dependencies">
|
||||
<fileset dir="${dist.libs.dir}" includes="*.jar"/>
|
||||
<fileset dir="${merge.libs.dir}" includes="*.jar"/>
|
||||
<fileset dir="${libs.windows.dir}" includes="*.jar"/>
|
||||
<fileset dir="${lib.dir}" includes="*.jar"/>
|
||||
</path>
|
||||
|
||||
<!-- clean =================================================================================== -->
|
||||
<target name="clean" description="Deletes files generated during the build.">
|
||||
<!--Delete created directory trees-->
|
||||
<delete dir="${target}"/>
|
||||
</target>
|
||||
|
||||
<!-- init =================================================================================== -->
|
||||
<target name="init">
|
||||
<!-- Check for min build requirements -->
|
||||
<condition property="ant.not.ok" value="true">
|
||||
<not>
|
||||
<contains string="${ant.version}" substring="1.6"/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="ant.not.ok" message="Must use Ant 1.6.x to build Spark"/>
|
||||
<!--
|
||||
<condition property="java.not.ok" value="true">
|
||||
<not>
|
||||
<contains string="${ant.java.version}" substring="1.4"/>
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<fail if="java.not.ok" message="Must use JDK 1.4.x to build Spark"/>
|
||||
-->
|
||||
|
||||
<!-- Platform-specific initializations -->
|
||||
<condition property="windows">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="unix">
|
||||
<os family="unix"/>
|
||||
</condition>
|
||||
<condition property="solaris">
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="linux">
|
||||
<os name="Linux"/>
|
||||
</condition>
|
||||
<condition property="mac">
|
||||
<os name="Mac OS X"/>
|
||||
</condition>
|
||||
|
||||
<!--creates the build directory-->
|
||||
<mkdir dir="${target}"/>
|
||||
<mkdir dir="${classes}"/>
|
||||
<mkdir dir="${target.build}"/>
|
||||
<mkdir dir="${target.resources}"/>
|
||||
<mkdir dir="${targetlib}"/>
|
||||
<mkdir dir="${targetlogs}"/>
|
||||
<mkdir dir="${targetdocs}"/>
|
||||
<mkdir dir="${plugins}"/>
|
||||
<mkdir dir="${bin}"/>
|
||||
</target>
|
||||
|
||||
<!-- resources =================================================================================== -->
|
||||
<target name="resources">
|
||||
<copy todir="${classes}">
|
||||
<fileset dir="${resources.dir}">
|
||||
<include name="**/*"/>
|
||||
</fileset>
|
||||
<fileset dir="../src/java">
|
||||
<include name="**/*.properties"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${target.resources}">
|
||||
<fileset dir="${resources.dir}">
|
||||
<exclude name="*.bat"/>
|
||||
<exclude name="settings.xml"/>
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${target.resources}/sounds">
|
||||
<fileset dir="${resources.dir}/sounds">
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- build =================================================================================== -->
|
||||
<target name="build" depends="init, resources, base">
|
||||
<!--Compiles the java code from ${src} directory into ${classes} directory-->
|
||||
<javac destdir="${classes}"
|
||||
debug="on"
|
||||
source="1.5"
|
||||
target="1.5"
|
||||
>
|
||||
<classpath>
|
||||
<path refid="agent.dependencies"/>
|
||||
</classpath>
|
||||
<src path="${src}"/>
|
||||
</javac>
|
||||
<touch file="${targetlogs}/error.log"/>
|
||||
<copy todir="${targetdocs}">
|
||||
<fileset dir="../documentation" includes="**/*" excludes="changes.*">
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${targetlib}/windows">
|
||||
<fileset dir="${libs.windows.dir}">
|
||||
<include name="**/*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${targetlib}/linux">
|
||||
<fileset dir="${libs.linux.dir}">
|
||||
<include name="**/*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${targetlib}">
|
||||
<fileset dir="${dist.libs.dir}">
|
||||
<include name="**/*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${bin}">
|
||||
<fileset dir="${resources.dir}">
|
||||
<include name="startup.bat"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- jar =================================================================================== -->
|
||||
<target name="jar" depends="build">
|
||||
<!--Put everything in ${classes} into the MyProject-${DSTAMP}.jar file-->
|
||||
<tstamp/>
|
||||
<jar jarfile="${targetlib}/spark.jar" basedir="${classes}"/>
|
||||
</target>
|
||||
|
||||
<!-- javadocs =================================================================================== -->
|
||||
<target name="release.javadocs" depends="jar, javadocs"
|
||||
description="creates javadocs version for developer source builds">
|
||||
</target>
|
||||
|
||||
<!-- base =================================================================================== -->
|
||||
<target name="base" depends="init" description="Produces Base Jars For Jive Spark">
|
||||
<mkdir dir="${targetlib}"/>
|
||||
<!-- Make main Messenger jar -->
|
||||
<jar jarfile="${targetlib}/base.jar" index="true">
|
||||
<zipgroupfileset dir="${merge.libs.dir}" includes="*.jar"/>
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="Jive Software (www.jivesoftware.com)"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- javadocs =================================================================================== -->
|
||||
<target name="javadocs" depends="init">
|
||||
<mkdir dir="${targetdocsapi}"/>
|
||||
<javadoc destdir="${targetdocsapi}" author="true" version="true" use="true" windowtitle="API for Agent">
|
||||
<classpath>
|
||||
<path refid="agent.dependencies"/>
|
||||
</classpath>
|
||||
<fileset dir="${src}" defaultexcludes="yes">
|
||||
<exclude name="**/*.properties"/>
|
||||
<exclude name="**/*.html"/>
|
||||
</fileset>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<!-- changelog =============================================================================== -->
|
||||
<target name="changelog"
|
||||
description="Generates an incremental changelog file based upon the XML/RSS feed from JIRA">
|
||||
<xslt in="../documentation/changes.xml" out="../target/changes.html" style="../documentation/changes.xsl"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- tests =================================================================================== -->
|
||||
<target name="build_tests" depends="init">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="run_tests" depends="build, build_tests">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="report" depends="run_tests">
|
||||
<!--
|
||||
<junitreport todir="${reports}">
|
||||
<fileset dir="${reports}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report format="noframes" todir="${htmlreports}"/>
|
||||
</junitreport>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<target name="development" depends="clean, jar, javadocs"
|
||||
description="Creates a development environment for Sparkplugs">
|
||||
<mkdir dir="${sparkplugs.build}"/>
|
||||
<mkdir dir="${sparkplugs.build}/spark"/>
|
||||
<mkdir dir="${sparkplugs.build}/builder"/>
|
||||
<mkdir dir="${sparkplugs.build}/images"/>
|
||||
<mkdir dir="${sparkplugs.build}/api"/>
|
||||
|
||||
<copy todir="${sparkplugs.build}/spark">
|
||||
<fileset file="${target.resources}" includes="**/*"/>
|
||||
<fileset file="${targetlib}" includes="**/*"/>
|
||||
<fileset file="${plugins}" includes="**/*"/>
|
||||
<fileset file="${bin}" includes="**/*"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${sparkplugs.build}">
|
||||
<fileset file="${targetdocs}/plugin_development_guide.html"/>
|
||||
<fileset file="${targetdocs}/style.css"/>
|
||||
<fileset file="${targetdocs}/examples.jar"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${sparkplugs.build}/images">
|
||||
<fileset file="${target.build}/documentation/images/*.*"/>
|
||||
</copy>
|
||||
<copy todir="${sparkplugs.build}/api">
|
||||
<fileset file="${target.build}/documentation/api/**"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${sparkplugs.build}/builder">
|
||||
<fileset file="${basedir}/builder/**"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- installers ============================================================================= -->
|
||||
|
||||
<target name="installer.win" depends="jar"
|
||||
description="build Install4J release executable and docs dirs for Windows">
|
||||
|
||||
<property name="installer.install4j.home" value="c:\\Program Files\\install4j"/>
|
||||
<condition property="install4j.not.ok" value="true">
|
||||
<not>
|
||||
<available file="${installer.install4j.home}/bin/install4j.jar"/>
|
||||
</not>
|
||||
</condition>
|
||||
<fail if="install4j.not.ok" message="Path to Install4j not set, see build.properties.template file."/>
|
||||
|
||||
<taskdef name="install4j"
|
||||
classname="com.install4j.Install4JTask"
|
||||
classpath="${installer.install4j.home}/bin/install4j.jar"/>
|
||||
|
||||
<mkdir dir="${installer.dest.dir}"/>
|
||||
|
||||
<install4j projectfile="${installer.install4j.srcfile}" destination="${installer.dest.dir}">
|
||||
<variable name="VERSION_MAJOR" value="${version.major}"/>
|
||||
<variable name="VERSION_MINOR" value="${version.minor}"/>
|
||||
<variable name="VERSION_REVISION" value="${version.revision}"/>
|
||||
<variable name="APP_NAME" value="${installer.app_name}"/>
|
||||
<variable name="APP_SHORT_NAME" value="${installer.app_short_name}"/>
|
||||
<variable name="PRODUCT_NAME" value="${installer.product_name}"/>
|
||||
<variable name="PUBLISHER" value="${installer.publisher}"/>
|
||||
<variable name="PUBLISHER_URL" value="${installer.publisher_url}"/>
|
||||
<variable name="FILE_PREFIX" value="${installer.app_short_name}"/>
|
||||
<variable name="RELEASE_ROOT_PATH" value="${installer.release_root_path}"/>
|
||||
</install4j>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="mac.clean">
|
||||
<delete dir="${mac.build.dir}"/>
|
||||
<delete file="${target}/tmp.dmg"/>
|
||||
<delete file="${mac.dmg.file}"/>
|
||||
</target>
|
||||
|
||||
<target name="mac.build.plugin" depends="jar">
|
||||
<!-- build the apple jar and place it in the plugins -->
|
||||
<ant antfile="../src/plugins/apple/build.xml" inheritall="no" target="clean"/>
|
||||
<ant antfile="../src/plugins/apple/build.xml" inheritall="no" target="jar"/>
|
||||
|
||||
<!-- build the growl jar and place it in the plugins -->
|
||||
<ant antfile="../src/plugins/growl/build.xml" inheritall="no" target="clean"/>
|
||||
<ant antfile="../src/plugins/growl/build.xml" inheritall="no" target="jar"/>
|
||||
</target>
|
||||
|
||||
<target name="mac.app" depends="mac.clean,mac.build.plugin">
|
||||
|
||||
<!-- http://www.loomcom.com/jarbundler/ -->
|
||||
<taskdef name="jarbundler"
|
||||
classpath="${basedir}/lib/jarbundler-1.4.jar"
|
||||
classname="com.loomcom.ant.tasks.jarbundler.JarBundler"/>
|
||||
|
||||
<mkdir dir="${mac.build.dir}"/>
|
||||
|
||||
<jarbundler dir="${mac.build.dir}"
|
||||
name="Spark"
|
||||
mainclass="org.jivesoftware.Spark"
|
||||
icon="${target}/classes/images/message.icns"
|
||||
version="${version.period}"
|
||||
infostring="Spark ${version.period}, (c) Jive Software 2005"
|
||||
aboutmenuname="Spark"
|
||||
bundleid="com.jivesoftware.SparkBundle"
|
||||
developmentregion="English"
|
||||
jvmversion="1.4+"
|
||||
smalltabs="true"
|
||||
antialiasedgraphics="true"
|
||||
antialiasedtext="true"
|
||||
liveresize="true"
|
||||
growbox="true"
|
||||
growboxintrudes="false"
|
||||
screenmenu="true"
|
||||
vmoptions="-Dappdir=$APP_PACKAGE/Contents/Resources"
|
||||
workingdirectory="$APP_PACKAGE/Contents/Resources"
|
||||
extraclasspath="/System/Library/Java">
|
||||
<jarfileset dir="${target.build}/lib">
|
||||
<include name="**/*.jar"/>
|
||||
<exclude name="**/windows/"/>
|
||||
</jarfileset>
|
||||
<jarfileset dir="${target.build}/lib/windows">
|
||||
<include name="jdic.jar"/>
|
||||
</jarfileset>
|
||||
<jarfileset dir="${basedir}/lib">
|
||||
<include name="i4jruntime.jar"/>
|
||||
</jarfileset>
|
||||
</jarbundler>
|
||||
|
||||
<copy todir="${mac.app.file}/Contents/Resources">
|
||||
<fileset dir="${target.build}">
|
||||
<exclude name="**/lib/"/>
|
||||
<exclude name="**/jniwrap.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="installer.mac" depends="mac.app" description="build Install4J release dmg file for the Macintosh">
|
||||
<fileset file="*.dmg"/>
|
||||
<exec executable="hdiutil" failonerror="true">
|
||||
<arg value="create"/>
|
||||
<arg value="-srcfolder"/>
|
||||
<arg value="${mac.build.dir}"/>
|
||||
<arg value="-fs"/>
|
||||
<arg value="HFS+"/>
|
||||
<arg value="${target}/tmp.dmg"/>
|
||||
</exec>
|
||||
<exec executable="hdiutil" failonerror="true">
|
||||
<arg line="convert ${target}/tmp.dmg -format UDZO -o ${mac.dmg.file}"/>
|
||||
</exec>
|
||||
<delete file="${target}/tmp.dmg"/>
|
||||
<exec executable="hdiutil" failonerror="true">
|
||||
<arg value="internet-enable"/>
|
||||
<arg value="-yes"/>
|
||||
<arg value="${mac.dmg.file}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
77
build/builder/build/build.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<project name="sparkplug" default="jar" basedir="..">
|
||||
|
||||
<property name="plug.dir" value="${basedir}/."/>
|
||||
<property name="plug.lib.dir" value="${plug.dir}/lib"/>
|
||||
|
||||
<property name="classes.dir" value="${basedir}/build/classes"/>
|
||||
<property name="src.dir" value="${plug.dir}/src"/>
|
||||
<property name="target.dir" value="${plug.dir}/target"/>
|
||||
<property name="target.lib.dir" value="${plug.dir}/target/lib"/>
|
||||
<property name="jar.file" value="${target.dir}/lib/plugin-classes.jar"/>
|
||||
|
||||
<property name="spark.home" value="${plug.dir}/../spark" />
|
||||
|
||||
<path id="lib.classpath">
|
||||
<fileset dir="${plug.lib.dir}" includes="**/*.jar, **/*.zip"/>
|
||||
<fileset dir="${spark.home}/lib" includes="**/*.jar, **/*.zip"/>
|
||||
<fileset dir="${spark.home}/lib/windows" includes="**/*.jar" />
|
||||
</path>
|
||||
|
||||
<target name="clean" description="Cleans all build related output">
|
||||
<delete file="${jar.file}"/>
|
||||
<delete dir="${classes.dir}"/>
|
||||
<delete dir="${target.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compiles plugin source">
|
||||
<mkdir dir="${classes.dir}"/>
|
||||
<javac srcdir="${src.dir}"
|
||||
destdir="${classes.dir}"
|
||||
classpathref="lib.classpath"
|
||||
source="1.4"
|
||||
debug="true"
|
||||
target="1.4"/>
|
||||
<copy todir="${classes.dir}">
|
||||
<fileset dir="${src.dir}" includes="**/*.png"/>
|
||||
<fileset dir="${src.dir}" includes="**/*.gif"/>
|
||||
<fileset dir="${src.dir}" includes="**/*.jpg"/>
|
||||
<fileset dir="${src.dir}" includes="**/*.jpeg"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="clean,compile" description="Makes a plugin jar">
|
||||
<mkdir dir="${target.dir}" />
|
||||
<mkdir dir="${target.lib.dir}"/>
|
||||
|
||||
<copy todir="${target.lib.dir}">
|
||||
<fileset file="${plug.lib.dir}/lib" includes="**/*"/>
|
||||
</copy>
|
||||
|
||||
<copy todir="${target.dir}">
|
||||
<fileset file="${plug.dir}/plugin.xml"/>
|
||||
</copy>
|
||||
|
||||
<jar basedir="${classes.dir}" file="${jar.file}" update="false"/>
|
||||
|
||||
<zip zipfile="${plug.dir}/myplugin.jar" basedir="${target.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="run" depends="jar" description="Makes a plugin jar and starts Spark with that plugin">
|
||||
<copy todir="${basedir}/../spark/plugins"
|
||||
file="${plug.dir}/myplugin.jar" />
|
||||
|
||||
<property name="sparklib" value="${basedir}/../spark/lib" />
|
||||
<java fork="true" classname="org.jivesoftware.Spark" dir="${basedir}/../spark/bin">
|
||||
<classpath>
|
||||
<fileset dir="${sparklib}">
|
||||
<include name="**/*.jar" />
|
||||
<include name="**/*.exe" />
|
||||
<include name="**/*.dll" />
|
||||
</fileset>
|
||||
<pathelement location="${basedir}/../spark/resources" />
|
||||
</classpath>
|
||||
<jvmarg value="-Dappdir=${basedir}/../spark" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
16
build/builder/how-to-build.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Building a Sparkplug
|
||||
|
||||
To easily build a Sparkplug, we have added a simple ANT script to create a deployed plug. To create, do the following:
|
||||
|
||||
1) Copy your java source files to the src directory.
|
||||
2) Place any dependencies (besides Spark) into the lib directory.
|
||||
3) Update the plugin.xml file to represent your plugin.
|
||||
4) Go to the build directory, and type ant jar to build your plugin or
|
||||
.... type "ant run" to build and deploy your plugin directly to Spark and
|
||||
have Spark startup to test your plugin right away.
|
||||
|
||||
Your new plugin will be called myplugin.jar.
|
||||
|
||||
If you wish to deploy your plugin later, just copy your new myplugin.jar to the plugins directory of your Sparkplug distro kit.
|
||||
|
||||
Enjoy!
|
||||
11
build/builder/plugin.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Define your plugins -->
|
||||
<plugin>
|
||||
<name>My Plugin</name>
|
||||
<version>1.0</version>
|
||||
<author>You</author>
|
||||
<homePage>http://www.jivesoftware.org</homePage>
|
||||
<email>foo@foo.com</email>
|
||||
<description>Sample Plugin</description>
|
||||
<class>com.jivesoftware.plugin.MyPlugin</class>
|
||||
</plugin>
|
||||
|
||||
1
build/built_target.bat
Normal file
@ -0,0 +1 @@
|
||||
ant -f %1 jar
|
||||
1
build/built_target.sh
Normal file
@ -0,0 +1 @@
|
||||
ant -f $1 jar
|
||||
BIN
build/installer/images/liveassistant-16x16.png
Normal file
|
After Width: | Height: | Size: 660 B |
BIN
build/installer/images/liveassistant-32x32.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
153
build/installer/spark.install4j
Normal file
@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<install4j version="3.2.1">
|
||||
<directoryPresets config="../../docs" />
|
||||
<application name="%APP_NAME%" distributionSourceDir="" applicationId="3057-7228-2063-7466" mediaDir="../../../../.." mediaFilePattern="spark_%VERSION%" compression="6" lzmaCompression="true" keepModificationTimes="false" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="false" macSignature="????" javaMinVersion="1.4" javaMaxVersion="1.5" allowBetaVM="false">
|
||||
<searchSequence>
|
||||
<registry />
|
||||
<envVar name="JAVA_HOME" />
|
||||
<envVar name="JDK_HOME" />
|
||||
</searchSequence>
|
||||
<variables>
|
||||
<variable name="VERSION_MAJOR" value="1" />
|
||||
<variable name="VERSION_MINOR" value="1" />
|
||||
<variable name="VERSION_REVISION" value="9" />
|
||||
<variable name="APP_NAME" value="Spark" />
|
||||
<variable name="APP_SHORT_NAME" value="Spark" />
|
||||
<variable name="PUBLISHER" value="Jive Software" />
|
||||
<variable name="PUBLISHER_URL" value="http://www.jivesoftware.com" />
|
||||
<variable name="PRODUCT_NAME" value="Spark" />
|
||||
<variable name="FILE_PREFIX" value="" />
|
||||
<variable name="RELEASE_ROOT_PATH" value="../target/installer" />
|
||||
<variable name="VARIABLE" value="" />
|
||||
<variable name="MACSYSTEM" value="/System/Library/Java" />
|
||||
</variables>
|
||||
</application>
|
||||
<files>
|
||||
<mountPoints>
|
||||
<mountPoint name="" id="1" location="" mode="755" />
|
||||
</mountPoints>
|
||||
<entries>
|
||||
<dirEntry mountPoint="1" file="../../target/build" overwrite="1" shared="false" mode="644" dontUninstall="false" excludeSuffixes="" dirMode="755">
|
||||
<exclude>
|
||||
<entry location="resources/version.xml~" launcher="false" />
|
||||
</exclude>
|
||||
</dirEntry>
|
||||
</entries>
|
||||
<components />
|
||||
</files>
|
||||
<launchers>
|
||||
<launcher name="Spark" id="4" external="false" excludeFromMenu="false" menuName="" icnsFile="../../resources/images/message.icns" pngIcon16File="../../resources/images/message.png" pngIcon32File="../../resources/images/message-32x32.png" macServiceDependencies="" allowUserChangeServiceStartType="true">
|
||||
<executable name="Spark" type="1" iconSet="true" iconFile="../../resources/images/message.ico" executableDir="." redirectStderr="true" stderrFile="logs/error.log" redirectStdout="true" stdoutFile="logs/output.log" failOnStderrOutput="true" executableMode="1" changeWorkingDirectory="true" workingDirectory="." singleInstance="false" serviceStartType="2" serviceDependencies="" serviceDescription="communicator" jreLocation="">
|
||||
<versionInfo include="true" fileVersion="%VERSION%" companyName="" fileDescription="Spark" legalCopyright="Jive Software" productVersion="" internalName="%PRODUCT_NAME%" />
|
||||
</executable>
|
||||
<splashScreen show="false" autoOff="true" alwaysOnTop="true" width="0" height="0" bitmapFile="">
|
||||
<text>
|
||||
<statusLine x="20" y="20" text="" font="Arial" fontSize="8" fontColor="0,0,0" fontWeight="500" />
|
||||
<versionLine x="20" y="40" text="version %VERSION%" font="Arial" fontSize="8" fontColor="0,0,0" fontWeight="500" />
|
||||
</text>
|
||||
</splashScreen>
|
||||
<java mainClass="com.jivesoftware.Spark" vmParameters=""-Dappdir=%INSTALL4J_EXEDIR%"" arguments="" allowVMPassthroughParameters="true" minVersion="" maxVersion="" preferredVM="client" allowBetaVM="false" jdkOnly="false">
|
||||
<searchSequence>
|
||||
<registry />
|
||||
<envVar name="JAVA_HOME" />
|
||||
<envVar name="JDK_HOME" />
|
||||
</searchSequence>
|
||||
<classPath>
|
||||
<scanDirectory location="lib" failOnError="true" />
|
||||
<directory location="resources" failOnError="false" />
|
||||
<scanDirectory location="lib/windows" failOnError="false" />
|
||||
<envVar name="macSystem" failOnError="false" />
|
||||
<scanDirectory location="lib/linux" failOnError="false" />
|
||||
</classPath>
|
||||
<nativeLibraryDirectories />
|
||||
</java>
|
||||
<includedFiles />
|
||||
</launcher>
|
||||
</launchers>
|
||||
<installerGui installerType="1" runUninstallerOnUpdate="true" addOnAppId="" suggestPreviousLocations="true" allowUnattendedInstall="true" useCustomHeaderImage="false" customHeaderImage="" customSize="false" customWidth="500" customHeight="390">
|
||||
<customCode preAction="false" preActionClass="" postAction="true" postActionClass="com.jivesoftware.Installer" preUninstallAction="false" preUninstallActionClass="" postUninstallAction="true" postUninstallActionClass="com.jivesoftware.Uninstaller" initHandler="false" initHandlerClass="" directoryValidator="false" directoryValidatorClass="" installationHandler="false" installationHandlerClass="">
|
||||
<archive location="../../target/build/lib/spark.jar" />
|
||||
</customCode>
|
||||
<standardScreens>
|
||||
<screen id="welcome" enabled="true" useCustomBanner="false" bannerImageFile="" background="255,255,255" />
|
||||
<screen id="license" enabled="true" file="../../docs/LICENSE.html" />
|
||||
<screen id="location" enabled="true" showSpace="true" suggestAppDir="true" />
|
||||
<screen id="components" enabled="true" allSelected="true" firstMandatory="true">
|
||||
<selectedComponents />
|
||||
<mandatoryComponents />
|
||||
</screen>
|
||||
<screen id="programGroup" enabled="true" />
|
||||
<screen id="fileAssociations" enabled="true">
|
||||
<associations />
|
||||
</screen>
|
||||
<screen id="services" enabled="true" allSelected="true">
|
||||
<selectedServiceLaunchers />
|
||||
</screen>
|
||||
<screen id="additionalTasks" enabled="true" customTasksPlacement="1">
|
||||
<customTasks />
|
||||
</screen>
|
||||
<screen id="preInfo" enabled="false" file="" />
|
||||
<screen id="install" enabled="true" />
|
||||
<screen id="postInfo" enabled="false" file="" />
|
||||
<screen id="finished" enabled="true" useCustomBanner="false" bannerImageFile="" background="255,255,255" />
|
||||
</standardScreens>
|
||||
<customScreens />
|
||||
</installerGui>
|
||||
<mediaSets>
|
||||
<win32 name="Windows" id="2" mediaFileName="" installDir="Spark" allLaunchers="true" includedJRE="windows-x86-1.5.0_05_us_only" manualJREEntry="false" bundleType="1" jreURL="" jreFtpURL="" jreShared="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="4" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="false" languageID="en" modeDesktopIcon="3" desktopLauncherId="4" programGroup="Spark" allowUserDisableStartMenuCreation="false" reboot="false" rebootUninstaller="false" modeQuickLaunchIon="2">
|
||||
<selectedLaunchers />
|
||||
<messageSet language="English" />
|
||||
<exclude>
|
||||
<entry location="bin/startup.bat" launcher="false" />
|
||||
<entry location="lib/linux" launcher="false" />
|
||||
</exclude>
|
||||
<variables />
|
||||
<excludedScreenIds />
|
||||
<additionalStartMenuEntries />
|
||||
</win32>
|
||||
<macos name="Mac OS X Single Bundle" id="6" mediaFileName="" installDir="%APP_SHORT_NAME%" allLaunchers="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="4" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="false" languageID="en" modeDesktopIcon="1" desktopLauncherId="">
|
||||
<selectedLaunchers>
|
||||
<launcher id="4" />
|
||||
</selectedLaunchers>
|
||||
<messageSet language="English" />
|
||||
<exclude />
|
||||
<variables />
|
||||
<excludedScreenIds />
|
||||
</macos>
|
||||
<win32 name="Updater" id="12" mediaFileName="CommunicatorUpdate" installDir="Jive Communicator" allLaunchers="false" includedJRE="" manualJREEntry="false" bundleType="1" jreURL="" jreFtpURL="" jreShared="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="4" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="false" languageID="en" modeDesktopIcon="1" desktopLauncherId="" programGroup="Jive IM" allowUserDisableStartMenuCreation="false" reboot="false" rebootUninstaller="false" modeQuickLaunchIon="1">
|
||||
<selectedLaunchers>
|
||||
<launcher id="4" />
|
||||
</selectedLaunchers>
|
||||
<messageSet language="English" />
|
||||
<exclude />
|
||||
<variables />
|
||||
<excludedScreenIds />
|
||||
<additionalStartMenuEntries />
|
||||
</win32>
|
||||
<unixArchive name="Unix Archive" id="13" mediaFileName="" installDir="%APP_SHORT_NAME%" allLaunchers="true" includedJRE="linux-x86-1.5.0_06" manualJREEntry="false" customScriptMode="1" customScriptFile="">
|
||||
<selectedLaunchers />
|
||||
<messageSet language="English" />
|
||||
<exclude>
|
||||
<entry location="bin/startup.bat" launcher="false" />
|
||||
<entry location="lib/windows" launcher="false" />
|
||||
</exclude>
|
||||
<variables />
|
||||
<customScriptLines />
|
||||
</unixArchive>
|
||||
<win32 name="Windows NON-JRE" id="19" mediaFileName="spark_%VERSION%_online" installDir="Spark" allLaunchers="true" includedJRE="windows-x86-1.5.0_05_us_only" manualJREEntry="false" bundleType="2" jreURL="http://www.jivesoftware.org/updater/releases/windows-x86-1.5.0_05.tar.gz" jreFtpURL="" jreShared="false" customInstallBaseDir="" allowUserStartAfterFinish="true" launchExecutableId="4" createUninstallIcon="true" overrideLicenseFile="false" licenseFile="" overridePreInformationFile="false" preInformationFile="" overridePostInformationFile="false" postInformationFile="" adminRequired="false" languageID="en" modeDesktopIcon="3" desktopLauncherId="4" programGroup="Spark" allowUserDisableStartMenuCreation="false" reboot="false" rebootUninstaller="false" modeQuickLaunchIon="2">
|
||||
<selectedLaunchers />
|
||||
<messageSet language="English" />
|
||||
<exclude>
|
||||
<entry location="bin/startup.bat" launcher="false" />
|
||||
<entry location="lib/linux" launcher="false" />
|
||||
</exclude>
|
||||
<variables />
|
||||
<excludedScreenIds />
|
||||
<additionalStartMenuEntries />
|
||||
</win32>
|
||||
</mediaSets>
|
||||
<buildIds buildAll="false">
|
||||
<mediaSet refId="2" />
|
||||
</buildIds>
|
||||
</install4j>
|
||||
|
||||
BIN
build/lib/dist/activation.jar
vendored
Normal file
BIN
build/lib/dist/dom4j.jar
vendored
Normal file
BIN
build/lib/dist/linux/jdic.jar
vendored
Normal file
BIN
build/lib/dist/linux/libjdic.so
vendored
Normal file
BIN
build/lib/dist/linux/libmozembed-linux-gtk1.2.so
vendored
Normal file
BIN
build/lib/dist/linux/libmozembed-linux-gtk2.so
vendored
Normal file
BIN
build/lib/dist/linux/libtray.so
vendored
Normal file
BIN
build/lib/dist/linux/mozembed-linux-gtk1.2
vendored
Normal file
BIN
build/lib/dist/linux/mozembed-linux-gtk2
vendored
Normal file
BIN
build/lib/dist/smack.jar
vendored
Normal file
BIN
build/lib/dist/smackx-debug.jar
vendored
Normal file
BIN
build/lib/dist/smackx.jar
vendored
Normal file
BIN
build/lib/dist/windows/IeEmbed.exe
vendored
Normal file
BIN
build/lib/dist/windows/MozEmbed.exe
vendored
Normal file
BIN
build/lib/dist/windows/jdic.dll
vendored
Normal file
BIN
build/lib/dist/windows/jdic.jar
vendored
Normal file
BIN
build/lib/dist/windows/tray.dll
vendored
Normal file
BIN
build/lib/dist/xpp.jar
vendored
Normal file
BIN
build/lib/dist/xstream.jar
vendored
Normal file
BIN
build/lib/i4jruntime.jar
Normal file
BIN
build/lib/jarbundler-1.4.jar
Normal file
BIN
build/lib/merge/Wrapper.dll
Normal file
BIN
build/lib/merge/asterisk-im-client.jar
Normal file
BIN
build/lib/merge/backport-util-concurrent.jar
Normal file
BIN
build/lib/merge/commons-codec.jar
Normal file
BIN
build/lib/merge/commons-httpclient.jar
Normal file
BIN
build/lib/merge/commons-logging.jar
Normal file
BIN
build/lib/merge/jaxen.jar
Normal file
BIN
build/lib/merge/jniwrap.jar
Normal file
BIN
build/lib/merge/jtoaster-1.0.4.jar
Normal file
BIN
build/lib/merge/looks.jar
Normal file
BIN
build/lib/merge/swingx.jar
Normal file
BIN
build/lib/merge/systeminfo.jar
Normal file
BIN
build/lib/merge/updater.jar
Normal file
7
build/lib/merge/versions.txt
Normal file
@ -0,0 +1,7 @@
|
||||
hessian.jar -- hessian-3.0.8.jar
|
||||
xpp3.jar -- xpp3-1.1.3.4d_b4_min.jar
|
||||
xstream.jar -- xstream-1.1.jar
|
||||
looks.jar -- looks-1.3.jar
|
||||
|
||||
agent/jniwrap.jar -- jniwrap-2.7.1.jar
|
||||
agent/winlaf.jar -- winlaf-0.5.jar
|
||||
201
build/projects/Spark.ipr
Normal file
@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4" relativePaths="true">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
</component>
|
||||
<component name="CodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS" />
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
|
||||
</component>
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<option name="CLEAR_OUTPUT_DIRECTORY" value="true" />
|
||||
<option name="DEPLOY_AFTER_MAKE" value="0" />
|
||||
<resourceExtensions>
|
||||
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
||||
<entry name=".+\.(gif|png|jpeg|jpg)" />
|
||||
</resourceExtensions>
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
</wildcardResourcePatterns>
|
||||
</component>
|
||||
<component name="DataSourceManager" />
|
||||
<component name="DataSourceManagerImpl" />
|
||||
<component name="DependenciesAnalyzeManager">
|
||||
<option name="myForwardDirection" value="false" />
|
||||
</component>
|
||||
<component name="DependencyValidationManager" />
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points />
|
||||
</component>
|
||||
<component name="ExportToHTMLSettings">
|
||||
<option name="PRINT_LINE_NUMBERS" value="false" />
|
||||
<option name="OPEN_IN_BROWSER" value="false" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
</component>
|
||||
<component name="GUI Designer component loader factory" />
|
||||
<component name="JavacSettings">
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="true" />
|
||||
<option name="DEPRECATION" value="true" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" value="c:/agent/docs" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="JikesSettings">
|
||||
<option name="JIKES_PATH" value="" />
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="DEPRECATION" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="false" />
|
||||
<option name="IS_EMACS_ERRORS_MODE" value="true" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
</component>
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Spark.iml" filepath="$PROJECT_DIR$/Spark.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/src/plugins/spelling/Spelling.iml" filepath="$PROJECT_DIR$/src/plugins/spelling/Spelling.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="JDK 1.5.0" />
|
||||
<component name="RmicSettings">
|
||||
<option name="IS_EANABLED" value="false" />
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
<option name="GENERATE_NO_WARNINGS" value="false" />
|
||||
<option name="GENERATE_IIOP_STUBS" value="false" />
|
||||
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
||||
</component>
|
||||
<component name="libraryTable" />
|
||||
<component name="uidesigner-configuration">
|
||||
<option name="INSTRUMENT_CLASSES" value="true" />
|
||||
<option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
|
||||
</component>
|
||||
<UsedPathMacros />
|
||||
</project>
|
||||
|
||||
597
build/projects/Spark.iws
Normal file
@ -0,0 +1,597 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4" relativePaths="true">
|
||||
<component name="AspectsView" />
|
||||
<component name="BookmarkManager" />
|
||||
<component name="ChangeBrowserSettings">
|
||||
<option name="MAIN_SPLITTER_PROPORTION" value="0.3" />
|
||||
<option name="MESSAGES_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="USE_DATE_BEFORE_FILTER" value="false" />
|
||||
<option name="USE_DATE_AFTER_FILTER" value="false" />
|
||||
<option name="USE_CHANGE_BEFORE_FILTER" value="false" />
|
||||
<option name="USE_CHANGE_AFTER_FILTER" value="false" />
|
||||
<option name="DATE_BEFORE" value="" />
|
||||
<option name="DATE_AFTER" value="" />
|
||||
<option name="CHANGE_BEFORE" value="" />
|
||||
<option name="CHANGE_AFTER" value="" />
|
||||
</component>
|
||||
<component name="CheckinPanelState" />
|
||||
<component name="Commander">
|
||||
<leftPanel />
|
||||
<rightPanel />
|
||||
<splitter proportion="0.5" />
|
||||
</component>
|
||||
<component name="CompilerWorkspaceConfiguration">
|
||||
<option name="COMPILE_IN_BACKGROUND" value="false" />
|
||||
<option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
|
||||
<option name="CLOSE_MESSAGE_VIEW_IF_SUCCESS" value="true" />
|
||||
<option name="COMPILE_DEPENDENT_FILES" value="false" />
|
||||
</component>
|
||||
<component name="Cvs2Configuration">
|
||||
<option name="PRUNE_EMPTY_DIRECTORIES" value="true" />
|
||||
<option name="MERGING_MODE" value="0" />
|
||||
<option name="MERGE_WITH_BRANCH1_NAME" value="HEAD" />
|
||||
<option name="MERGE_WITH_BRANCH2_NAME" value="HEAD" />
|
||||
<option name="RESET_STICKY" value="false" />
|
||||
<option name="CREATE_NEW_DIRECTORIES" value="true" />
|
||||
<option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv" />
|
||||
<option name="PROCESS_UNKNOWN_FILES" value="false" />
|
||||
<option name="PROCESS_DELETED_FILES" value="false" />
|
||||
<option name="PROCESS_IGNORED_FILES" value="false" />
|
||||
<option name="RESERVED_EDIT" value="false" />
|
||||
<option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="UPDATE_DATE_OR_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_CHANGES_REVISION_SETTINGS">
|
||||
<value>
|
||||
<option name="BRANCH" value="" />
|
||||
<option name="DATE" value="" />
|
||||
<option name="USE_BRANCH" value="false" />
|
||||
<option name="USE_DATE" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="SHOW_OUTPUT" value="false" />
|
||||
<option name="ADD_WATCH_INDEX" value="0" />
|
||||
<option name="REMOVE_WATCH_INDEX" value="0" />
|
||||
<option name="UPDATE_KEYWORD_SUBSTITUTION" />
|
||||
<option name="MAKE_NEW_FILES_READONLY" value="false" />
|
||||
<option name="SHOW_CORRUPTED_PROJECT_FILES" value="0" />
|
||||
<option name="TAG_AFTER_FILE_COMMIT" value="false" />
|
||||
<option name="OVERRIDE_EXISTING_TAG_FOR_FILE" value="true" />
|
||||
<option name="TAG_AFTER_FILE_COMMIT_NAME" value="" />
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT" value="false" />
|
||||
<option name="OVERRIDE_EXISTING_TAG_FOR_PROJECT" value="true" />
|
||||
<option name="TAG_AFTER_PROJECT_COMMIT_NAME" value="" />
|
||||
<option name="CLEAN_COPY" value="false" />
|
||||
</component>
|
||||
<component name="DaemonCodeAnalyzer">
|
||||
<disable_hints />
|
||||
</component>
|
||||
<component name="DebuggerManager">
|
||||
<breakpoint_any>
|
||||
<breakpoint>
|
||||
<option name="NOTIFY_CAUGHT" value="true" />
|
||||
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||
<option name="ENABLED" value="false" />
|
||||
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||
<option name="LOG_ENABLED" value="false" />
|
||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||
<option name="COUNT_FILTER" value="0" />
|
||||
<option name="CONDITION_ENABLED" value="false" />
|
||||
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||
<option name="CONDITION" value="" />
|
||||
<option name="LOG_MESSAGE" value="" />
|
||||
</breakpoint>
|
||||
</breakpoint_any>
|
||||
<breakpoint_rules />
|
||||
<ui_properties />
|
||||
</component>
|
||||
<component name="ErrorTreeViewConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="HIDE_WARNINGS" value="false" />
|
||||
</component>
|
||||
<component name="FavoritesViewImpl">
|
||||
<favorites_list name="Spark">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="IS_SHOW_MEMBERS" value="false" />
|
||||
<option name="IS_STRUCTURE_VIEW" value="false" />
|
||||
<option name="IS_SHOW_MODULES" value="true" />
|
||||
<option name="IS_FLATTEN_PACKAGES" value="false" />
|
||||
<option name="IS_ABBREVIATION_PACKAGE_NAMES" value="false" />
|
||||
<option name="IS_HIDE_EMPTY_MIDDLE_PACKAGES" value="false" />
|
||||
<option name="IS_SHOW_LIBRARY_CONTENTS" value="true" />
|
||||
</favorites_list>
|
||||
<option name="myCurrentFavoritesList" value="Spark" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf />
|
||||
</component>
|
||||
<component name="FindManager">
|
||||
<FindUsagesManager>
|
||||
<setting name="OPEN_NEW_TAB" value="false" />
|
||||
</FindUsagesManager>
|
||||
</component>
|
||||
<component name="HierarchyBrowserManager">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="SORT_ALPHABETICALLY" value="false" />
|
||||
<option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
|
||||
</component>
|
||||
<component name="InspectionManager">
|
||||
<option name="AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="SPLITTER_PROPORTION" value="0.5" />
|
||||
<option name="GROUP_BY_SEVERITY" value="false" />
|
||||
<option name="ANALYZE_TEST_SOURCES" value="true" />
|
||||
<option name="SCOPE_TYPE" value="1" />
|
||||
<profile name="Default" />
|
||||
</component>
|
||||
<component name="J2EEProjectPane">
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark.ipr" />
|
||||
<option name="myItemType" value="com.intellij.j2ee.module.view.nodes.J2EEProjectNodeDescriptor" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<setting name="SHOW_AS_DEPLOYMENT_VIEW" value="false" />
|
||||
</component>
|
||||
<component name="ModuleEditorState">
|
||||
<option name="LAST_EDITED_MODULE_NAME" value="Spark" />
|
||||
<option name="LAST_EDITED_TAB_NAME" value="Libraries (Classpath)" />
|
||||
</component>
|
||||
<component name="NamedScopeManager" />
|
||||
<component name="PackagesPane">
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark.ipr" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark.ipr" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="org.jivesoftware" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</component>
|
||||
<component name="PerforceChangeBrowserSettings">
|
||||
<option name="USE_USER_FILTER" value="true" />
|
||||
<option name="USE_CLIENT_FILTER" value="true" />
|
||||
<option name="USER" value="" />
|
||||
<option name="CLIENT" value="" />
|
||||
</component>
|
||||
<component name="PerforceDirect.Settings">
|
||||
<option name="CURRENT_CHANGE_LIST" value="-1" />
|
||||
<option name="useP4CONFIG" value="true" />
|
||||
<option name="port" value="jasper:1666" />
|
||||
<option name="client" value="" />
|
||||
<option name="user" value="" />
|
||||
<option name="passwd" value="" />
|
||||
<option name="showCmds" value="false" />
|
||||
<option name="useNativeApi" value="true" />
|
||||
<option name="pathToExec" value="p4" />
|
||||
<option name="useCustomPathToExec" value="false" />
|
||||
<option name="SYNC_FORCE" value="false" />
|
||||
<option name="SYNC_RUN_RESOLVE" value="true" />
|
||||
<option name="REVERT_UNCHANGED_FILES" value="true" />
|
||||
<option name="CHARSET" value="none" />
|
||||
<option name="SHOW_BRANCHES_HISTORY" value="true" />
|
||||
<option name="ENABLED" value="true" />
|
||||
<option name="USE_LOGIN" value="false" />
|
||||
<option name="LOGIN_SILENTLY" value="false" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
<OptionsSetting value="true" id="Checkin" />
|
||||
<OptionsSetting value="true" id="Checkout" />
|
||||
<OptionsSetting value="true" id="Update" />
|
||||
<OptionsSetting value="true" id="Status" />
|
||||
<OptionsSetting value="true" id="Edit" />
|
||||
<OptionsSetting value="true" id="Undo Check Out" />
|
||||
<OptionsSetting value="true" id="Compare with SourceSafe Version" />
|
||||
<OptionsSetting value="true" id="Get Latest Version" />
|
||||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectPane">
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark.ipr" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark.ipr" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Spark" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="PsiDirectory:C:\code\spark\client" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</component>
|
||||
<component name="ProjectReloadState">
|
||||
<option name="STATE" value="0" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="PackagesPane" splitterProportion="0.5">
|
||||
<flattenPackages ProjectPane="false" />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages ProjectPane="false" />
|
||||
<abbreviatePackageNames />
|
||||
<showStructure PackagesPane="false" ProjectPane="false" />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
</navigator>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="GoToClass.includeJavaFiles" value="false" />
|
||||
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||
<property name="cvs_file_history_treeWidth0" value="294" />
|
||||
<property name="cvs_file_history_flatWidth2" value="294" />
|
||||
<property name="cvs_file_history_treeOrder1" value="1" />
|
||||
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||
<property name="cvs_file_history_flatOrder1" value="1" />
|
||||
<property name="cvs_file_history_flatWidth1" value="294" />
|
||||
<property name="cvs_file_history_treeWidth1" value="294" />
|
||||
<property name="GoToClass.includeLibraries" value="false" />
|
||||
<property name="MemberChooser.showClasses" value="true" />
|
||||
<property name="cvs_file_history_flatOrder2" value="2" />
|
||||
<property name="cvs_file_history_treeWidth2" value="294" />
|
||||
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
|
||||
<property name="cvs_file_history_flatOrder3" value="3" />
|
||||
<property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
|
||||
<property name="MemberChooser.sorted" value="false" />
|
||||
<property name="RunManagerConfig.compileBeforeRunning" value="false" />
|
||||
<property name="cvs_file_history_flatOrder0" value="0" />
|
||||
<property name="cvs_file_history_treeOrder3" value="3" />
|
||||
<property name="cvs_file_history_treeOrder2" value="2" />
|
||||
<property name="cvs_file_history_treeWidth3" value="293" />
|
||||
<property name="cvs_file_history_flatWidth0" value="294" />
|
||||
<property name="cvs_file_history_flatWidth3" value="293" />
|
||||
<property name="cvs_file_history_treeOrder0" value="0" />
|
||||
</component>
|
||||
<component name="ReadonlyStatusHandler">
|
||||
<option name="SHOW_DIALOG" value="true" />
|
||||
</component>
|
||||
<component name="RecentsManager" />
|
||||
<component name="RestoreUpdateTree" />
|
||||
<component name="RunManager">
|
||||
<activeType name="Application" />
|
||||
<tempConfiguration selected="false" default="false" name="SparkTabbedPane" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.spark.component.tabbedPane.SparkTabbedPane" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="Spark" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="2194" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</tempConfiguration>
|
||||
<configuration selected="false" default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ADDITIONAL_CLASS_PATH" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="wholeProject" />
|
||||
</option>
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<module name="" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
|
||||
<module name="" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="HTML_FILE_NAME" />
|
||||
<option name="HTML_USED" value="false" />
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
</configuration>
|
||||
<configuration selected="true" default="false" name="Spark" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="org.jivesoftware.Spark" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="Spark" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="1406" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="false" name="SparkToaster" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.sparkimpl.plugin.alerts.SparkToaster" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="Spark" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="1238" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="false" name="NightMode" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.Spark" />
|
||||
<option name="VM_PARAMETERS" value="-Dplugin=C:\code\spark\client\plugins\nightmode\plugin.xml" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="nightmode" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="1478" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="false" name="JNIWrapper" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.Spark" />
|
||||
<option name="VM_PARAMETERS" value="-Dplugin=C:\code\spark\client\plugins\jniwrapper\plugin.xml" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="JNIWrapper" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="3634" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="false" name="Spelling" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.Spark" />
|
||||
<option name="VM_PARAMETERS" value="-Dplugin=C:\code\spark\client\plugins\spelling\plugin.xml" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="Spelling" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="3635" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
<configuration selected="false" default="false" name="Fastpath" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="com.jivesoftware.Spark" />
|
||||
<option name="VM_PARAMETERS" value="-Dplugin=C:\code\spark\client\plugins\fastpath\plugin.xml" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<module name="Fastpath" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="3636" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SelectInManager" />
|
||||
<component name="StarteamConfiguration">
|
||||
<option name="SERVER" value="" />
|
||||
<option name="PORT" value="49201" />
|
||||
<option name="USER" value="" />
|
||||
<option name="PASSWORD" value="" />
|
||||
<option name="PROJECT" value="" />
|
||||
<option name="VIEW" value="" />
|
||||
<option name="ALTERNATIVE_WORKING_PATH" value="" />
|
||||
</component>
|
||||
<component name="StructuralSearchPlugin" />
|
||||
<component name="StructureViewFactory">
|
||||
<option name="AUTOSCROLL_MODE" value="true" />
|
||||
<option name="AUTOSCROLL_FROM_SOURCE" value="false" />
|
||||
<option name="ACTIVE_ACTIONS" value="" />
|
||||
</component>
|
||||
<component name="SvnChangesBrowserSettings">
|
||||
<option name="USE_AUTHOR_FIELD" value="true" />
|
||||
<option name="AUTHOR" value="" />
|
||||
<option name="LOCATION" value="" />
|
||||
<option name="USE_PROJECT_SETTINGS" value="true" />
|
||||
<option name="USE_ALTERNATE_LOCATION" value="false" />
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<option name="USER" value="" />
|
||||
<option name="PASSWORD" value="" />
|
||||
<configuration useDefault="false">C:\Documents and Settings\Derek DeMoro\Application Data\Subversion</configuration>
|
||||
</component>
|
||||
<component name="TodoView" selected-index="0">
|
||||
<todo-panel id="selected-file">
|
||||
<are-packages-shown value="false" />
|
||||
<are-modules-shown value="false" />
|
||||
<flatten-packages value="false" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
<todo-panel id="all">
|
||||
<are-packages-shown value="true" />
|
||||
<are-modules-shown value="false" />
|
||||
<flatten-packages value="false" />
|
||||
<is-autoscroll-to-source value="true" />
|
||||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="288" y="132" width="1278" height="992" extended-state="0" />
|
||||
<editor active="false" />
|
||||
<layout>
|
||||
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="8" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3298731" order="7" />
|
||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.23327896" order="0" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32407406" order="1" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3252315" order="8" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3995381" order="6" />
|
||||
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="3" />
|
||||
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="8" />
|
||||
<window_info id="Favorites" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32980457" order="3" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32837528" order="2" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.2496" order="2" />
|
||||
<window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="3" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3784722" order="4" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3275463" order="8" />
|
||||
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0" />
|
||||
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="3" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VCS.FileViewConfiguration">
|
||||
<option name="SELECTED_STATUSES" value="DEFAULT" />
|
||||
<option name="SELECTED_COLUMNS" value="DEFAULT" />
|
||||
<option name="SHOW_FILTERS" value="true" />
|
||||
<option name="CUSTOMIZE_VIEW" value="true" />
|
||||
<option name="SHOW_FILE_HISTORY_AS_TREE" value="true" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
|
||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||
<option name="ERROR_OCCURED" value="false" />
|
||||
<option name="ACTIVE_VCS_NAME" value="" />
|
||||
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
||||
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||
<MESSAGE value="Fixing tab pane for Megan." />
|
||||
<MESSAGE value="Updating to fix loading of plugins." />
|
||||
<MESSAGE value="Removing fastpath from Spark." />
|
||||
<MESSAGE value="Removed other references of Fastpath." />
|
||||
<MESSAGE value="Making external plugins." />
|
||||
<MESSAGE value="Updating JNIWrapper." />
|
||||
<MESSAGE value="Updating Spelling plugin." />
|
||||
<MESSAGE value="Update Fastpath Plugin." />
|
||||
<MESSAGE value="Refactoring." />
|
||||
<MESSAGE value="Fixed build script." />
|
||||
</component>
|
||||
<component name="VssConfiguration">
|
||||
<option name="CLIENT_PATH" value="" />
|
||||
<option name="SRCSAFEINI_PATH" value="" />
|
||||
<option name="USER_NAME" value="" />
|
||||
<option name="PWD" value="" />
|
||||
<option name="VSS_IS_INITIALIZED" value="true" />
|
||||
<CheckoutOptions>
|
||||
<option name="COMMENT" value="" />
|
||||
<option name="DO_NOT_GET_LATEST_VERSION" value="false" />
|
||||
<option name="REPLACE_WRITABLE" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</CheckoutOptions>
|
||||
<CheckinOptions>
|
||||
<option name="COMMENT" value="" />
|
||||
<option name="KEEP_CHECKED_OUT" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</CheckinOptions>
|
||||
<AddOptions>
|
||||
<option name="COMMENT" value="" />
|
||||
<option name="STORE_ONLY_LATEST_VERSION" value="false" />
|
||||
<option name="CHECK_OUT_IMMEDIATELY" value="false" />
|
||||
<option name="FILE_TYPE" value="0" />
|
||||
</AddOptions>
|
||||
<UndocheckoutOptions>
|
||||
<option name="MAKE_WRITABLE" value="false" />
|
||||
<option name="REPLACE_LOCAL_COPY" value="0" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</UndocheckoutOptions>
|
||||
<GetOptions>
|
||||
<option name="REPLACE_WRITABLE" value="0" />
|
||||
<option name="MAKE_WRITABLE" value="false" />
|
||||
<option name="RECURSIVE" value="false" />
|
||||
</GetOptions>
|
||||
</component>
|
||||
<component name="antWorkspaceConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager" />
|
||||
</project>
|
||||
|
||||
313
documentation/LICENSE.html
Normal file
@ -0,0 +1,313 @@
|
||||
<html>
|
||||
<title>LICENSE AGREEMENT</title>
|
||||
|
||||
<body>
|
||||
|
||||
<span style='font-size:10.0pt;font-family:Arial'>
|
||||
|
||||
<p align=center style='text-align:center'><b>Spark End User License
|
||||
Agreement</b></p>
|
||||
|
||||
<p>THIS IS A
|
||||
LEGAL AGREEMENT between "you," the end user of the Spark
|
||||
software and any related plugin software, and CoolServlets, Inc. DBA Jive
|
||||
Software, a Delaware limited liability company ("Jive Software").</p>
|
||||
|
||||
<p>BY
|
||||
COMPLETING THE ONLINE REGISTRATION FORM AND CLICKING THE "I AGREE" BUTTON, YOU
|
||||
SUBMIT TO JIVE SOFTWARE AN OFFER TO OBTAIN THE RIGHT TO USE THE LICENSED
|
||||
PRODUCTS (DEFINED BELOW) UNDER THE PROVISIONS OF THIS END USER LICENSE
|
||||
AGREEMENT (THE "AGREEMENT"), UNLESS A SEPARATE LICENSE AGREEMENT, WHICH,
|
||||
EXPRESSLY BY ITS TERMS, HAS PRECEDENCE OVER THIS AGREEMENT, HAS BEEN SIGNED BY
|
||||
BOTH PARTIES. </p>
|
||||
|
||||
<p class=MsoBodyText style='text-indent:0in'><span style='font-size:10.0pt;
|
||||
font-family:Arial'>BY CLICKING THE "I AGREE" BUTTON, YOU HEREBY AGREE THAT YOU
|
||||
HAVE THE REQUISITE AUTHORITY, POWER AND RIGHT TO FULLY BIND THE PERSON AND/OR
|
||||
ENTITIES (COLLECTIVELY,"YOU") WISHING TO USE THE LICENSED PRODUCTS PURSUANT TO
|
||||
THIS AGREEMENT. If YOU DO NOT HAVE THE
|
||||
AUTHORITY TO BIND SUCH PERSON OR ENTITY OR YOU OR SUCH PERSON OR ENTITY do not
|
||||
agree to any of the terms below, JIVE SOFTWARE is unwilling to PROVIDE THE
|
||||
LICENSED PRODUCTS TO THE LICENSEE, and you should click on the "Do Not Accept"
|
||||
button below to discontinue the REGISTRATION process. </p>
|
||||
|
||||
<p>As used in
|
||||
this Agreement, the capitalized term "Licensed Products" means,
|
||||
collectively, (a) the freeware version of the Spark instant
|
||||
messaging software("Spark"), (b) the related plugin software for
|
||||
which no fee is charged, as set forth in the registration form ("Free
|
||||
Plugins"), (c) the related plugin software for which a fee is charged, as set
|
||||
forth in the registration form ("Commercial Plugins") and (d) any and all
|
||||
enhancements, upgrades, and updates that may be provided to you in the future
|
||||
by Jive Licensed Products from time to time and in its sole discretion
|
||||
("Upgrades"). </p>
|
||||
|
||||
<p>Section B
|
||||
applies solely with respect to Spark and any Free Plugins. Section
|
||||
C applies solely with respect to Commercial Plugins to Spark. The
|
||||
remainder of this Agreement applies to all Licensed Products.</p>
|
||||
|
||||
<p><b>A.   Ownership</b></p>
|
||||
|
||||
<p>The
|
||||
Licensed Products and any accompanying documentation are owned by Jive Software
|
||||
and ownership of the Licensed Products and such documentation shall at all
|
||||
times remain with Jive Software. Copies are provided to you only to allow
|
||||
you to exercise your rights under this Agreement. This Agreement does not
|
||||
constitute a sale of the Licensed Products or any accompanying documentation,
|
||||
or any portion thereof. Without limiting the generality of the foregoing,
|
||||
you do not receive any rights to any patents, copyrights, trade secrets,
|
||||
trademarks or other intellectual property rights relating to or in the Licensed
|
||||
Products or any accompanying documentation other than as expressly set forth in
|
||||
the license grants in this Agreement. All rights not expressly granted to
|
||||
you under this Agreement are reserved by Jive Licensed Products.</p>
|
||||
|
||||
<p><b>B.   Grant of License Applicable To Spark and any Freeware Plugins</b></p>
|
||||
|
||||
<p>Subject to
|
||||
the terms and conditions set out in this Agreement, Jive Software grants you a
|
||||
limited, nonexclusive, nontransferable, nonsublicensable, and revocable right
|
||||
to use the Spark and any Free Plugins, together the "Free Licensed
|
||||
Products," solely in accordance with the following terms and conditions:</p>
|
||||
|
||||
<p style='text-indent:.5in'><span style='font-size:10.0pt;
|
||||
font-family:Arial'>1. Use of the Free Licensed
|
||||
Products. The Free Licensed Products is being distributed as
|
||||
freeware. This means it may be freely used, copied and distributed as
|
||||
long as it is not sold or distributed for any consideration and all original
|
||||
files are included, including this Agreement and Jive Software's copyright
|
||||
notice. You may use the Free Licensed Products on as many computers as
|
||||
you require.</p>
|
||||
|
||||
<p style='text-indent:.5in'><span style='font-size:10.0pt;
|
||||
font-family:Arial'>2. Distribution
|
||||
Permitted. You may make copies of your copy of the Free Licensed Products
|
||||
to give to others provided that such copies are not modified from the original
|
||||
downloaded copy of the Free Licensed Products. You may not charge a fee
|
||||
for distributing copies of the Free Licensed Products except that freeware
|
||||
distribution companies may charge their normal shipping and handling fees not
|
||||
to exceed $5.00 U.S. per copy. If any copies of the Free Licensed Products
|
||||
are distributed, Jive Licensed Products requires that you send Jive Licensed
|
||||
Products an e-mail addressed to <a href="mailto:info@jivesoftware.com">info@jivesoftware.com</a>
|
||||
notifying Jive Licensed Products of such distribution and the identity of the
|
||||
person or entity receiving the copy of the Free Licensed Products including a
|
||||
listing of which products such person received.</p>
|
||||
|
||||
<p style='text-indent:.5in'><span style='font-size:10.0pt;
|
||||
font-family:Arial'>3. Termination. Jive
|
||||
Software may terminate your license in the Free Licensed Products at any time,
|
||||
for any reason or no reason. </p>
|
||||
|
||||
<p style='text-indent:.5in'><span style='font-size:10.0pt;
|
||||
font-family:Arial'>4. Fees. There is no
|
||||
license fee for the Free Licensed Products. If you wish to receive the
|
||||
Commercial Plugins (defined below) for Spark, you will be required
|
||||
to pay the applicable license fee.</p>
|
||||
|
||||
<p><b>C.   Grant of License Applicable To any Commercial Plugins for Spark</b></p>
|
||||
|
||||
<p>Subject to
|
||||
the terms and conditions set out in this Agreement, Jive Software grants you a
|
||||
limited, nonexclusive, nontransferable, nonsublicensable and revocable right to
|
||||
use the Commercial Plugins solely in accordance with the following terms and
|
||||
conditions:</p>
|
||||
|
||||
<p style='text-indent:.5in'>1. Use of Commercial
|
||||
Plugins. You may download and internally use the Commercial Plugins on
|
||||
multiple computers owned, leased or rented by you; however, you are only
|
||||
allowed to run the Commercial Plugins on (a) your own computer, or (b) on as
|
||||
many computers as you have purchased seat licenses ("Seat Licenses"), as listed
|
||||
on the product invoice ("Invoice") made available to you via the world wide web
|
||||
after you have submitted a purchase order for such Commercial Plugins, or on
|
||||
the receipt ("Receipt") made available to you via the world wide web after you
|
||||
have submitted an online order for such Commercial Plugins. All copies of
|
||||
Spark and its Commercial Plugins must include Jive Licensed
|
||||
Product's copyright notice.</p>
|
||||
|
||||
<p style='text-indent:.5in'>2. Distribution
|
||||
Prohibited. You may not distribute copies of the Commercial Plugins for
|
||||
use by any individual other than to those computers for which you have
|
||||
purchased the Commercial Plugins Seat Licenses. Distribution to or
|
||||
allowing any third party access or use of the Commercial Plugins by you,
|
||||
whether by means of a service bureau, lease or otherwise, is hereby expressly prohibited.</p>
|
||||
|
||||
<p style='text-indent:.5in'>3. Fees. You shall pay
|
||||
to Jive Software all "Fees" consisting of "License Fees" for the Licensed
|
||||
Products and related Maintenance and Support Fees ("Maintenance and Support
|
||||
Fees"). Maintenance and Support Fees are good for one (1) year for application
|
||||
for which Maintenance and Support Services Fee has been paid as of the date of
|
||||
the invoice or online purchase and/or any anniversaries of such date, and then
|
||||
annual payment of Maintenance and Support Services Fee required for renewal
|
||||
thereafter, unless Licensee has paid in advance for future years. All such
|
||||
Fees shall be as listed on the Invoice and/or Receipt. </p>
|
||||
|
||||
<p style='text-indent:.5in'>4. Maintenance and
|
||||
Support. Jive Licensed Products will provide you with support services
|
||||
("Support Services") for a period that begins on the purchase date and ends 365
|
||||
days later, unless you elect to continue paying the Maintenance and Support
|
||||
Fees. The nature, scope and extent of Support Services shall be as set
|
||||
forth on Jive Software's website at <a
|
||||
href="http://www.jivesoftware.com/support/overview.jsp">http://www.jivesoftware.com/support/overview.jsp</a>.
|
||||
Support terms are subject to change in Jive Software's sole discretion. Jive
|
||||
Software will also provide you with Upgrades for a period that begins on the
|
||||
purchase date and ends 365 days later, unless you elect to continue paying the
|
||||
Maintenance and Support Fees. Such Upgrades will include any Upgrades for
|
||||
Spark and the Commercial Plugins that are released by Jive Licensed
|
||||
Products for general distribution during the one year period for which you are
|
||||
entitled to receive free Upgrades. Jive Licensed Products has no
|
||||
obligation to provide you with any Upgrades that are not released for general
|
||||
distribution to Jive Licensed Products's other licensees. Nothing in this
|
||||
Agreement shall be construed to obligate Jive Licensed Products to provide
|
||||
Upgrades to you under any circumstances.</p>
|
||||
|
||||
<p><b>D.   Prohibited Conduct</b></p>
|
||||
|
||||
<p>You
|
||||
represent and warrant that you will not violate any of the terms and conditions
|
||||
set forth in this Agreement and that:</p>
|
||||
|
||||
<p>You will
|
||||
not, and will not permit others to: (i) reverse engineer, decompile,
|
||||
disassemble, derive the source code of, modify, or create derivative works from
|
||||
the Licensed Products; or (ii) use, copy, modify, alter, or transfer,
|
||||
electronically or otherwise, the Licensed Products or any of the accompanying
|
||||
documentation except as expressly permitted in this Agreement; or (iii)
|
||||
redistribute, sell, rent, lease, sublicense, or otherwise transfer rights to
|
||||
the Licensed Products whether in a stand-alone configuration or as incorporated
|
||||
with other software code written by any party except as expressly permitted in
|
||||
this Agreement.</p>
|
||||
|
||||
<p>You will
|
||||
not use the Licensed Products to engage in or allow others to engage in any
|
||||
illegal activity.</p>
|
||||
|
||||
<p>You will
|
||||
not engage in use of the Licensed Products that will interfere with or damage
|
||||
the operation of the services of third parties by overburdening/disabling
|
||||
network resources through automated queries, excessive usage or similar
|
||||
conduct.</p>
|
||||
|
||||
<p>You will
|
||||
not use the Licensed Products to engage in any activity that will violate the
|
||||
rights of third parties, including, without limitation, through the use, public
|
||||
display, public performance, reproduction, distribution, or modification of
|
||||
communications or materials that infringe copyrights, trademarks, publicity
|
||||
rights, privacy rights, other proprietary rights, or rights against defamation
|
||||
of third parties.</p>
|
||||
|
||||
<p>You will
|
||||
not transfer the Licensed Products or utilize the Licensed Products in
|
||||
combination with third party software authored by you or others to create an
|
||||
integrated software program which you transfer to unrelated third parties.</p>
|
||||
|
||||
<p><b>E.   Upgrades, Updates And Enhancements</b></p>
|
||||
|
||||
<p>All
|
||||
Upgrades shall be deemed to be part of the Licensed Products and will be
|
||||
subject to this Agreement.</p>
|
||||
|
||||
<p><b>F.   Disclaimer of Warranty</b></p>
|
||||
|
||||
<p>THE
|
||||
LICENSED PRODUCTS ARE PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTIES THAT IT IS
|
||||
FREE OF DEFECTS, VIRUS FREE, ABLE TO OPERATE ON AN UNINTERRUPTED BASIS,
|
||||
MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, WITH CLEAR TITLE OR
|
||||
NON-INFRINGING. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART
|
||||
OF THIS LICENSE AND AGREEMENT. NO USE OF THE LICENSED PRODUCTS ARE
|
||||
AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. JIVE SOFTWARE DOES NOT
|
||||
GUARANTEE THAT ANY OF THE LICENSED PRODUCTS SHALL MEET YOUR SPECIFIC NEEDS. </p>
|
||||
|
||||
<p><b>G.   Limitation of Liability</b></p>
|
||||
|
||||
<p>TO THE
|
||||
MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL JIVE SOFTWARE BE
|
||||
LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OF OR INABILITY TO USE THE LICENSED PRODUCTS, INCLUDING, WITHOUT
|
||||
LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
|
||||
FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF THE LEGAL OR EQUITABLE
|
||||
THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS BASED. IN
|
||||
ANY CASE, JIVE SOFTWARE'S COLLECTIVE LIABILITY UNDER ANY PROVISION OF THIS
|
||||
LICENSE SHALL NOT EXCEED IN THE AGGREGATE (1) WITH RESPECT TO
|
||||
COMMERCIAL PLUGINS, THE SUM OF THE FEES YOU PAID FOR THE LICENSE TO SUCH
|
||||
COMMERCIAL PLUGINS AND (2) WITH RESPECT TO FREE LICENSED PRODUCTS, $100.</p>
|
||||
|
||||
<p><b>H.   Export Control</b></p>
|
||||
|
||||
<p>The
|
||||
Licensed Products may contain encryption and is subject to United States export control laws and regulations and may be subject to export or import regulations
|
||||
in other countries, including controls on encryption products. You agree
|
||||
that you will not export, re-export or transfer the Licensed Products in
|
||||
violation of any applicable laws or regulations of the United States or the country where you legally obtained it. You are responsible for obtaining
|
||||
any licenses to export, re-export, transfer or import the Licensed Products. </p>
|
||||
|
||||
<p>In addition
|
||||
to the above, the Licensed Products may not be used by, or exported or
|
||||
re-exported to: (i) any U.S. or EU sanctioned or embargoed country, or to
|
||||
nationals or residents of such countries; or (ii) to any person, entity or
|
||||
organization or other party identified on the U.S. Department of Commerce.s
|
||||
Table of Denial Orders or the U.S. Department of Treasury.s lists of .Specially
|
||||
Designated Nationals and Blocked Persons,. as published and revised from time
|
||||
to time; (iii) to any party engaged in nuclear, chemical/biological weapons or
|
||||
missile proliferation activities, unless authorized by U.S. and local (as
|
||||
required) law or regulations.</p>
|
||||
|
||||
<p><b>I.   Legends and Notices</b></p>
|
||||
|
||||
<p>You agree
|
||||
that you will not remove or alter any trademark, logo, copyright or other
|
||||
proprietary notices, legends, symbols or labels in the Licensed Products or any
|
||||
accompanying documentation.</p>
|
||||
|
||||
<p><b>J.   Term and Termination</b></p>
|
||||
|
||||
<p>This
|
||||
Agreement is effective upon your acceptance as provided herein and payment of
|
||||
the applicable Fees (if any), and will remain in force until terminated.
|
||||
You may terminate the licenses granted in this Agreement at any time by
|
||||
destroying the Licensed Products and any accompanying documentation, together
|
||||
with any and all copies thereof. The licenses granted in this Agreement
|
||||
will terminate automatically if you breach any of its terms or conditions or
|
||||
any of the terms or conditions of any other agreement between you and Jive
|
||||
Licensed Products. Upon termination, you shall immediately destroy the
|
||||
original and all copies of the Licensed Products and any accompanying
|
||||
documentation, or return them to Jive Licensed Products and you shall retain no
|
||||
further rights in or to the Licensed Products.</p>
|
||||
|
||||
<p><b>K.   Licensed Products Suggestions</b></p>
|
||||
|
||||
<p>Jive
|
||||
Software welcomes suggestions for enhancing the Licensed Products and any
|
||||
accompanying documentation that may result in computer programs, reports,
|
||||
presentations, documents, ideas or inventions relating or useful to Jive
|
||||
Software's business. You acknowledge that all title, ownership rights, and
|
||||
intellectual property rights concerning such suggestions shall become the
|
||||
exclusive property of Jive Software and may be used for its business purposes
|
||||
in its sole discretion without any payment or accounting to you and you hereby
|
||||
assign all such rights to Jive Software irrevocably.</p>
|
||||
|
||||
<p><b>Miscellaneous</b></p>
|
||||
|
||||
<p>This
|
||||
Agreement constitutes the entire agreement between the parties concerning the
|
||||
Licensed Products, and may be amended only by a writing signed by both parties
|
||||
that expressly references this Agreement. This Agreement shall be
|
||||
governed by the laws of the State of Oregon, excluding its conflict of law
|
||||
provisions. All disputes relating to this Agreement are subject to the
|
||||
exclusive jurisdiction of the courts of Multnomah County, Oregon and you
|
||||
expressly consent to the exercise of personal jurisdiction in the courts of Multnomah County, Oregon in connection with any such dispute. This Agreement shall
|
||||
not be governed by the United Nations Convention on Contracts for the
|
||||
International Sale of Goods. If any provision in this Agreement should be
|
||||
held illegal or unenforceable by a court of competent jurisdiction, such
|
||||
provision shall be modified to the extent necessary to render it enforceable
|
||||
without losing its intent, or severed from this Agreement if no such modification
|
||||
is possible, and other provisions of this Agreement shall remain in full force
|
||||
and effect. A waiver by either party of any term or condition of this
|
||||
Agreement or any breach thereof, in any one instance, shall not waive such term
|
||||
or condition or any subsequent breach thereof. You will indemnify Jive Software
|
||||
for any breach of the terms or conditions of this Agreement. </p>
|
||||
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
||||
162
documentation/README.html
Normal file
@ -0,0 +1,162 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Jive Spark README</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
BODY {
|
||||
|
||||
font-size : 100%;
|
||||
|
||||
}
|
||||
|
||||
BODY, TD, TH {
|
||||
|
||||
font-family : tahoma, verdana, arial, helvetica, sans-serif;
|
||||
|
||||
font-size : 0.8em;
|
||||
|
||||
}
|
||||
|
||||
A:hover {
|
||||
|
||||
text-decoration : none;
|
||||
|
||||
}
|
||||
|
||||
.pageheader {
|
||||
|
||||
font-family : arial, helvetica, sans-serif;
|
||||
|
||||
font-size : 14pt;
|
||||
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
H1 {
|
||||
|
||||
font-family : tahoma, arial, helvetica, sans-serif;
|
||||
|
||||
font-size : 1.4em;
|
||||
|
||||
font-weight: bold;
|
||||
|
||||
border-bottom : 1px #ccc solid;
|
||||
|
||||
padding-bottom : 2px;
|
||||
|
||||
display : inline;
|
||||
|
||||
padding-left : 5px;
|
||||
|
||||
}
|
||||
|
||||
H2 {
|
||||
|
||||
font-weight: bold;
|
||||
|
||||
font-family : arial, helvetica, sans-serif;
|
||||
|
||||
font-size : 1.1em;
|
||||
|
||||
}
|
||||
|
||||
TT {
|
||||
|
||||
font-family : courier new;
|
||||
|
||||
font-weight : bold;
|
||||
|
||||
color : #060;
|
||||
|
||||
}
|
||||
|
||||
PRE {
|
||||
|
||||
font-family : courier new;
|
||||
|
||||
font-size : 100%;
|
||||
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
||||
font-size : 0.8em;
|
||||
|
||||
color : #666;
|
||||
|
||||
text-align : center;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<table border=0><tr>
|
||||
|
||||
<!--<td><img src="documentation/images/spark_logo.gif" width="59" height="40" alt="JC Logo"></td>-->
|
||||
|
||||
<td><h1>Jive Spark README</h1></td>
|
||||
|
||||
</tr></table>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
<table boder=0>
|
||||
|
||||
<tr>
|
||||
|
||||
<td>version:</td>
|
||||
|
||||
<td><b>2.0 Beta</b></td>
|
||||
|
||||
</tr><tr>
|
||||
|
||||
<td>released:</td>
|
||||
|
||||
<td><b>June 20, 2006</b></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<p>Thank you for choosing Spark!</p>
|
||||
|
||||
<p>Spark is a full-featured instant messaging (IM) client that uses the XMPP protocol.</p>
|
||||
|
||||
<p><b>Documentation</b><p>
|
||||
|
||||
<p>Basic information on Spark can be found in the <a href="install-guide.html">install guide</a> and
|
||||
on the <a href="http://www.jivesoftware.org"> Jive Software website</a>.</p>
|
||||
|
||||
<p>If you need additional help using or installing Spark,
|
||||
please visit the <a href="http://www.jivesoftware.org/community/kbcategory.jspa?categoryID=23">
|
||||
online support forums</a>. Commercial support (email and phone) from
|
||||
<a href="mailto:support@jivesoftware.com">Jive Software Support</a> is also available.
|
||||
|
||||
<p><b>Changelog</b><p>
|
||||
|
||||
View the <a href="changelog.html">changelog</a> for a list of changes since the last release.
|
||||
|
||||
<p><b>License Agreements</b><p>
|
||||
|
||||
<p>By using this software, you agree to the terms of the included <a href="LICENSE.html">license agreement</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
documentation/builder.jar
Normal file
388
documentation/changelog.html
Normal file
@ -0,0 +1,388 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Spark Changelog</title>
|
||||
<style type="text/css">
|
||||
BODY {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
BODY, TD, TH {
|
||||
font-family: tahoma, verdana, arial, helvetica, sans-serif;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
A:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pageheader {
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
H1 {
|
||||
font-family: tahoma, arial, helvetica, sans-serif;
|
||||
font-size: 1.4em;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px #ccc solid;
|
||||
padding-bottom: 2px;
|
||||
display: inline;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
H2 {
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
TT {
|
||||
font-family: courier new;
|
||||
font-weight: bold;
|
||||
color: #060;
|
||||
}
|
||||
|
||||
PRE {
|
||||
font-family: courier new;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 0.8em;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<table border=0><tr>
|
||||
<!--<td><img src="documentation/images/spark_logo.gif" width="59" height="40" alt="JC Logo"></td>-->
|
||||
<td><h1>Spark Changelog</h1></td>
|
||||
</tr></table>
|
||||
<br><br>
|
||||
|
||||
<b>2.0 Beta</b> -- June 20th, 2006
|
||||
<p>
|
||||
<h2>New Feature</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-302'>SPARK-302</a>] - Added Nested Groups support to Spark</li>
|
||||
</ul>
|
||||
|
||||
<h2>Bug</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-294'>SPARK-294</a>] - Need better logic around avatar handling</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-301'>SPARK-301</a>] - Offline messages are not saved in transcript history.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-303'>SPARK-303</a>] - Fixed Memory leak in ChatRoom.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Improvement</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-298'>SPARK-298</a>] - Presence updates should show timestamp.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
<b>1.1.4</b> -- April 13, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<h2>New Features</h2>
|
||||
|
||||
<h2>Bug</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-277'>SPARK-277</a>] - Losing a connection on Linux and Mac versions now prompts to close Spark.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-257'>SPARK-257</a>] - Right-click on misspelled words in input editor now shows popup on Linux.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-262'>SPARK-262</a>] - Group Chat history now displays users previous messages.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-264'>SPARK-264</a>] - Chat window blinks when contact window is minimized.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-269'>SPARK-269</a>] - ESC now closes the Conference Picker window.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-271'>SPARK-271</a>] - Drag and Drop works in the entire transcript window.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-272'>SPARK-272</a>] - Broadcast messages now make all urls clickable.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-273'>SPARK-273</a>] - MAC dmg shows the the correct version of Spark.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Improvements</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-259'>SPARK-259</a>] - Group Chat rooms now show the presence of the users.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-256'>SPARK-256</a>] - Added access to the API to allow for modifications of the BookmarkedConference UI.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-263'>SPARK-263</a>] - Chat History ui now displays previous message based on dates.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-265'>SPARK-265</a>] - Added a "Save As.." on right-click of file transfer documents.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-267'>SPARK-267</a>] - Added a tooltip on each Chat Room tab to display the full jid of the user you are talking with.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-274'>SPARK-274</a>] - Decreased memory consumption in Spark by 5 megs.</li>
|
||||
</ul>
|
||||
|
||||
<b>1.1.3</b> -- March 15, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<h2>Bug</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-242'>SPARK-242</a>] - Broadcasting messages now works fine with all clients.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-243'>SPARK-243</a>] - Changing nickname to " a " in a MUC room is now trimmed.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-244'>SPARK-244</a>] - Adding a pre-exisiting user to a new group now shows the user in that group.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-246'>SPARK-246</a>] - Failed registration re-enables the Create Button in "Account Creation"</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-248'>SPARK-248</a>] - Links are made with most types of URLs.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-249'>SPARK-249</a>] - The ChatFrame notifies the user that they have lost a connection. </li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-250'>SPARK-250</a>] - Loading preferences error has been fixed.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-25'>SPARK-25</a>] - API - VCard handling is now centralized.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Improvement</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-204'>SPARK-204</a>] - We now use the multi-select dialog box for file transfers.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-247'>SPARK-247</a>] - Improved icons for broadcasting to groups.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<b>1.1.2</b> -- March 9, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<h2>New Features</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-110'>SPARK-110</a>] - Improved broadcasting UI to better determine between normal and broadcasted messages.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-151'>SPARK-151</a>] - Made network paths clickable links similiar like http links.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-226'>SPARK-226</a>] - Prompt user to have their history deleted when they check "Disable chat history is enabled".</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-228'>SPARK-228</a>] - Set Spark to away when workstation is locked.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Improvements</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-3'>SPARK-3</a>] - Added ability to broadcast messages to groups.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-107'>SPARK-107</a>] - Allow groups state to be persisted at logout.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-143'>SPARK-143</a>] - LocalPreferences now loads quicker.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-211'>SPARK-211</a>] - Made drag and drop of files into send area work.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Bug Fixes</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-140'>SPARK-140</a>] - Offline Messages no longer throw exceptions on startup.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-146'>SPARK-146</a>] - Exodus now responds to conference request.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-203'>SPARK-203</a>] - Auto-reply message from Trillian is now handled correctly.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-217'>SPARK-217</a>] - You can bookmark unlimited number of rooms on Macs.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-224'>SPARK-224</a>] - Removed unused documents in the docs directory.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-225'>SPARK-225</a>] - Update check and Plugins Repo now use http proxy settings.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-230'>SPARK-230</a>] - Chat notification tab now turns red in all cases.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-232'>SPARK-232</a>] - Fixed Ctrl+c in ChatInputArea.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-233'>SPARK-233</a>] - Sound settings no longer freeze Spark.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-236'>SPARK-236</a>] - Added support for spaces in nicknames while joining MUC rooms.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-241'>SPARK-241</a>] - Revoke/Grant Voice menu options now toggle correctly.</li>
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.1.1</b> -- February 16, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<h2>Bug Fixes</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-223'>SPARK-223</a>] - Spark now escapes passwords.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-216'>SPARK-216</a>] - Spark now remebers "Show Empty Groups".</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-215'>SPARK-215</a>] - Log out on Linux works correctly now.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-214'>SPARK-214</a>] - Offline messages now show previous chat history.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-213'>SPARK-213</a>] - Fixed bug when transferring 0 byte files.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-212'>SPARK-212</a>] - Plugin Viewer now shows proper error message.</li>
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.1.0</b> -- February 9, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p><h2>New Features</h2></p>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-199'>SPARK-199</a>] - Spark now has a Linux release.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-135'>SPARK-135</a>] - Added support for Sparkplugs -- includes a plugin viewer to install and uninstall plugins.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-115'>SPARK-115</a>] - Greatly improved file transfer feature.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-144'>SPARK-144</a>] - Spark now has an emoticon picker in the chat room.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-198'>SPARK-198</a>] - If a group is collapsed, that's now remembered between Spark restarts.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-142'>SPARK-142</a>] - ChatPreference is now part of the base Spark code.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-32'>SPARK-32</a>] - Added better disconnect information.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-153'>SPARK-153</a>] - Update icons to better match function.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-131'>SPARK-131</a>] - Users can disable chat history feature in spark.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-90'>SPARK-90</a>] - History messages are now displayed with the date and time the message was sent or received.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-186'>SPARK-186</a>] - Broadcasted messages now appear in their own dialog.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-165'>SPARK-165</a>] - When Spark is set to start minimized, login failures now result in periodic retries without notification.
|
||||
</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-195'>SPARK-195</a>] - Improved UI on the download upgrade dialog.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-50'>SPARK-50</a>] - Added notification of sent broadcast.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-34'>SPARK-34</a>] - Added "Place Call" on right-click of contacts.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-139'>SPARK-139</a>] - Refactored source for public API release.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Bug Fixes</h2>
|
||||
<ul>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-9'>SPARK-9</a>] - 600+ Roster accounts caused Spark to slow down.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-51'>SPARK-51</a>] - Don't show "Invite" buttons and sub-menus if there is no default MUC service.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-52'>SPARK-52</a>] - Composing event was being sent with incorrect ID and even if the user didn't request it.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-56'>SPARK-56</a>] - Fixed issue that caused the dial phone pop-up stays open after the external call has completed.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-57'>SPARK-57</a>] - Drag-and drop of users between groups was failing on Macs.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-58'>SPARK-58</a>] - Call to user without asterisk account was ringing the wrong phone.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-60'>SPARK-60</a>] - Could not remove a contact that belongs to a shared group from a local group.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-61'>SPARK-61</a>] - Improved error handling when trying to change the subject of a room.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-70'>SPARK-70</a>] - Fixed error sending files between Exodus and Spark.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-73'>SPARK-73</a>] - There was no way to join a room that was not listed in the public directory.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-95'>SPARK-95</a>] - Clicking a URL in the chat history didn't work on Mac</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-145'>SPARK-145</a>] - Mac build was missing actions on conference participants.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-148'>SPARK-148</a>] - Fixed display of empty groups.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-168'>SPARK-168</a>] - Spark is now able to run as a limited user on Windows.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-170'>SPARK-170</a>] - Improved conference invitations UI.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-171'>SPARK-171</a>] - Creating accounts now works on ports other than just 5222.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-182'>SPARK-182</a>] - History settings are now being persisted with UTF-8 encoding.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-183'>SPARK-183</a>] - Adding and removing shared groups from the server was not showing properly in Spark.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-192'>SPARK-192</a>] - Resouces with space characters were not allowed.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-193'>SPARK-193</a>] - The default resource name be "Spark" instead of "spark".</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-194'>SPARK-194</a>] - The chat history was not being written during the update process.</li>
|
||||
<li>[<a href='http://www.jivesoftware.org/issues/browse/SPARK-196'>SPARK-196</a>] - Removed the unused "name" field under General Information</li>
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.0.4</b> -- January 23, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p><h2>New Features</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-157] - New Emoticon Picker has been added.</li>
|
||||
</ul>
|
||||
|
||||
<p><h2>Bug Fixes</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-166] - Cancelling File Transfers on incoming transfer cancels transfer.</li>
|
||||
<li>[SPARK-160] - Spark now resolves Domain using the service name.</li>
|
||||
<li>[SPARK-159] - Spark no longer writes out bogus entries into warning.log file.</li>
|
||||
<li>[SPARK-158] - File Transfer Open button now opens the file.</li>
|
||||
<li>[SPARK-156] - File Transfer is now creating the appropriate port to send.</li>
|
||||
<li>[SPARK-155] - Offline Messages now work in Spark.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.0.3</b> -- January 5, 2006</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p><h2>New Features</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-132] - Spark now comes with or without a JRE.</li>
|
||||
</ul>
|
||||
|
||||
<p><h2>Bug Fixes</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-130] - Spark no longer ignores XHTML.</li>
|
||||
<li>[SPARK-127] - Various enhancements to File Transfer.</li>
|
||||
<li>[SPARK-138] - Spark now escapes invalid chars.</li>
|
||||
<li>[SPARK-137] - Copying out of the chat history text area now works.</li>
|
||||
<li>[SPARK-133] - "Is Typing" will not be displayed once a message is received.</li>
|
||||
<li>[SPARK-129] - Clicking on the Refresh List no longer hangs Spark.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.0.2</b> -- December 15, 2005</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p><h2>New Features</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-124] - Can view entire chat history by right clicking on contact and selecting "View Entire History".</li>
|
||||
<li>[SPARK-114] - Spark now comes with an optional silent install Mode. To silently install, just pass in -q after the install file, e.g. "spark.exe -q".</li>
|
||||
<li>[SPARK-125] - Notifications have been added as a preference for Group Chat rooms.</li>
|
||||
<li>[SPARK-120] - Log Out appears right above exit in system tray menu.</li>
|
||||
<li>[SPARK-119] - "Create Account" button now appears on the login dialog.</li>
|
||||
<li>[SPARK-109] - Spell checker can be turned on/off in preferences.</li>
|
||||
<li>[SPARK-43] - Users can now specify their own resource to use before login.</li>
|
||||
<li>[SPARK-39] - User Search Service now toggles to new UI based on search service.</li>
|
||||
<li>[SPARK-1] - Display time/date can now be toggled via preferences.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p><h2>Bug Fixes</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-116] - Spark now works with secure connections to Wildfire when updating.</li>
|
||||
<li>[SPARK-122] - Fixed saving chat history on server disconnects.</li>
|
||||
<li>[SPARK-66] - Users and group are removed from Spark when user is removed from Shared Group.</li>
|
||||
<li>[SPARK-123] - Using & or < in a Contact Group is now escaped properly.</li>
|
||||
<li>[SPARK-113] - Sounds are now distributed with the installer.</li>
|
||||
<li>[SPARK-108] - Spark proprely changes back from away due to idle when computer is not idle.</li>
|
||||
<li>[SPARK-106] - Spark allows for PNG files to be selected as an Avatar.</li>
|
||||
<li>[SPARK-98] - Chat Frame no longer steals focus.</li>
|
||||
<li>[SPARK-67] - Double-click will make contact list visible from system tray.</li>
|
||||
<li>[SPARK-59] - Preferences now appear in correct location on Mac.</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.0.1</b> -- December 1, 2005</b>
|
||||
|
||||
<p>
|
||||
|
||||
<p><h2>New Features</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-74] - Added sounds for incoming and outgoing messages.</li>
|
||||
<li>[SPARK-20] - Added sound notification when user goes offline.</li>
|
||||
<li>[SPARK-83] - Added better visual queues of when a transfer is complete.</li>
|
||||
<li>[SPARK-90] - History messages are now displayed with the date and time the message was sent or received.</li>
|
||||
<li>[SPARK-79] - User directory for transcripts and custom settings are now in the user home to allow for a single binary / multiple user environment.</li>
|
||||
<li>[SPARK-77] - Auto-detection and explicit setting of host and port are now part of advanced options.</li>
|
||||
<li>[SPARK-23] - Free to chat uses a more intuitive icon.</li>
|
||||
<li>[SPARK-93] - Typing notification sent based on new algorithim of typing speak and typing char count.</li>
|
||||
<li>[SPARK-19] - Added preference to start Spark in system tray.</li>
|
||||
<li>[SPARK-13] - Roster Window and Chat Frame now remember their location and size.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p><h2>Bug Fixes</h2></p>
|
||||
<ul>
|
||||
<li>[SPARK-92] - Chat transcripts are now saved with to, from, date and body only.</li>
|
||||
<li>[SPARK-91] - Check for updates adheres to the once a week check rule.</li>
|
||||
<li>[SPARK-89] - Conference rooms created in Contact List are now private by default.</li>
|
||||
<li>[SPARK-86] - Time now shows up with version request.</li>
|
||||
<li>[SPARK-84] - Memory leak has been fixed with new sound plugin.</li>
|
||||
<li>[SPARK-81] - Improved scrolling behavior in chat history window.</li>
|
||||
<li>[SPARK-22] - Call button only calls user once.</li>
|
||||
<li>[SPARK-21] - Room owners are now displayed in room configuration data form.</li>
|
||||
<li>[SPARK-18] - Added option to change resource. Defaults to Spark instead of Jive.</li>
|
||||
<li>[SPARK-17] - Spark is running notification UI is now fixed to fit image and not steal focus.</li>
|
||||
<li>[SPARK-16] - Spark uses the port setting if specified in advanced options.</li>
|
||||
<li>[SPARK-12] - The Cancel button in Configure Chat Room dialog does not send a config form.</li>
|
||||
<li>[SPARK-11] - Unfiled entries are now displayed in Unfiled Group correctly.</li>
|
||||
<li>[SPARK-10] - Users can join unpublished conference rooms.</li>
|
||||
<li>[SPARK-8] - Spark now accepts 5 different arguments to either login automatically or start chat with person or join group chat.</li>
|
||||
<li>[SPARK-7] - Right-Click on status message node now forces focus onto node.</li>
|
||||
<li>[SPARK-6] - Status text in StatusManager UI will now be truncated if too long. Full text is now in tooltip.</li>
|
||||
<li>[SPARK-4] - Invalid Conference rooms are now escaped.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>1.0.0</b> -- November 17, 2005</b>
|
||||
|
||||
<p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>Initial release.
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
27
documentation/changes.xsl
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<body>
|
||||
<h2>Change log</h2>
|
||||
|
||||
<ul>
|
||||
<xsl:apply-templates/>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="channel">
|
||||
<xsl:apply-templates select="item"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<li>
|
||||
<xsl:value-of select="type"/>:
|
||||
[<xsl:value-of select="key"/>] - <xsl:value-of
|
||||
select="customfields/customfield[@id='customfield_10013']/customfieldvalues/customfieldvalue"
|
||||
/></li>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
BIN
documentation/images/banner-spark.gif
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
documentation/images/banner-spring.gif
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
documentation/images/chat-room.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
documentation/images/contact-list.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
documentation/images/login-dialog.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
44
documentation/install-guide.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Spark Installation Guide</title>
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table border=0><tr>
|
||||
<!--<td><img src="images/spark_logo.gif" width="59" height="40" alt="JC Logo"></td>-->
|
||||
<td><h1>Spark Installation Guide</h1></td>
|
||||
</tr></table>
|
||||
|
||||
<p>Spark consists of the following:
|
||||
|
||||
<ul>
|
||||
<li><b>spark</b> and <b>uninstall</b> executables, located in the top-level directory</li>
|
||||
<li><b>.install4j</b></li>
|
||||
<li><b>docs</b></li>
|
||||
<li><b>jre</b> (optional)</li>
|
||||
<li><b>lib</b></li>
|
||||
<li><b>logs</b></li>
|
||||
<li><b>plugins</b></li>
|
||||
<li><b>resources</b></li>
|
||||
|
||||
</ul></p>
|
||||
|
||||
|
||||
<h2>Installation</h2>
|
||||
<ul>
|
||||
<h3>Windows 95/NT/2000/XP</h3>
|
||||
Run the Spark installer, located in the spark.exe file.
|
||||
The application will be installed to
|
||||
<tt>c:\Program Files\Spark</tt> by default.
|
||||
|
||||
<h3>Macintosh OS X</h3>
|
||||
Download Spark, located in the spark.dmg file, and drag the application
|
||||
to your /Applications folder.
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1043
documentation/sparkplug_dev_guide.html
Normal file
124
documentation/style.css
Normal file
@ -0,0 +1,124 @@
|
||||
BODY {
|
||||
font-size : 100%;
|
||||
background-color : #fff;
|
||||
}
|
||||
BODY, TD, TH {
|
||||
font-family : arial, helvetica, sans-serif;
|
||||
font-size : 10pt;
|
||||
}
|
||||
PRE, TT, CODE {
|
||||
font-family : courier new, monospaced;
|
||||
font-size : 9pt;
|
||||
}
|
||||
A:hover {
|
||||
text-decoration : none;
|
||||
}
|
||||
LI {
|
||||
padding-bottom : 4px;
|
||||
}
|
||||
H1 {
|
||||
font-family : tahoma, arial, helvetica, sans-serif;
|
||||
font-size : 1.4em;
|
||||
font-weight: bold;
|
||||
border-bottom : 1px #ccc solid;
|
||||
padding-bottom : 2px;
|
||||
display : inline;
|
||||
padding-left : 5px;
|
||||
}
|
||||
H2 {
|
||||
font-size : 1.2em;
|
||||
font-weight : bold;
|
||||
}
|
||||
H3 {
|
||||
font-size : 1.0em;
|
||||
font-weight : bold;
|
||||
}
|
||||
TT {
|
||||
font-family : courier new;
|
||||
font-weight : bold;
|
||||
color : #060;
|
||||
}
|
||||
FIELDSET PRE {
|
||||
padding : 1em;
|
||||
margin : 0px;
|
||||
}
|
||||
FIELDSET {
|
||||
margin-left : 2em;
|
||||
margin-right : 2em;
|
||||
border : 1px #ccc solid;
|
||||
-moz-border-radius : 5px;
|
||||
}
|
||||
.comment {
|
||||
color : #666;
|
||||
font-style : italic;
|
||||
}
|
||||
|
||||
.subheader {
|
||||
font-weight : bold;
|
||||
}
|
||||
.footer {
|
||||
font-size : 0.8em;
|
||||
color : #999;
|
||||
text-align : center;
|
||||
width : 100%;
|
||||
border-top : 1px #ccc solid;
|
||||
padding-top : 2px;
|
||||
}
|
||||
.code {
|
||||
border : 1px #ccc solid;
|
||||
padding : 0em 1.0em 0em 1.0em;
|
||||
margin : 4px 0px 4px 0px;
|
||||
}
|
||||
.nav, .nav A {
|
||||
font-family : verdana;
|
||||
font-size : 0.85em;
|
||||
color : #600;
|
||||
text-decoration : none;
|
||||
font-weight : bold;
|
||||
}
|
||||
.note {
|
||||
font-family : verdana;
|
||||
font-size : 0.85em;
|
||||
color : #600;
|
||||
text-decoration : none;
|
||||
font-weight : bold;
|
||||
}
|
||||
.nav {
|
||||
width : 100%;
|
||||
border-bottom : 1px #ccc solid;
|
||||
padding : 3px 3px 5px 1px;
|
||||
}
|
||||
.nav A:hover {
|
||||
text-decoration : underline;
|
||||
}.question {
|
||||
font-weight: 600;
|
||||
}
|
||||
.answer {
|
||||
font-weight: 300;
|
||||
}
|
||||
.toc {
|
||||
right: 5px;
|
||||
}
|
||||
TABLE.dbtable {
|
||||
border : 1px #ccc solid;
|
||||
width : 600px;
|
||||
}
|
||||
TR, TH {
|
||||
border-bottom : 1px #ccc solid;
|
||||
}
|
||||
TH, TD {
|
||||
padding-right : 15px;
|
||||
}
|
||||
TH {
|
||||
text-align : left;
|
||||
white-space : nowrap;
|
||||
background-color : #eee;
|
||||
}
|
||||
.primary-key {
|
||||
background-color : #ffc;
|
||||
}
|
||||
#bannerbox .spring {
|
||||
background-image : url(images/banner-spring.gif);
|
||||
background-position : top;
|
||||
background-repeat : repeat-x;
|
||||
}
|
||||
290
src/java/org/jivesoftware/AccountCreationWizard.java
Normal file
@ -0,0 +1,290 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.smack.AccountManager;
|
||||
import org.jivesoftware.smack.SSLXMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.spark.component.TitlePanel;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class AccountCreationWizard extends JPanel {
|
||||
private JLabel usernameLabel = new JLabel();
|
||||
private JTextField usernameField = new JTextField();
|
||||
|
||||
private JLabel passwordLabel = new JLabel();
|
||||
private JPasswordField passwordField = new JPasswordField();
|
||||
|
||||
private JLabel confirmPasswordLabel = new JLabel();
|
||||
private JPasswordField confirmPasswordField = new JPasswordField();
|
||||
|
||||
private JLabel serverLabel = new JLabel();
|
||||
private JTextField serverField = new JTextField();
|
||||
|
||||
private JButton createAccountButton = new JButton();
|
||||
private JButton closeButton = new JButton();
|
||||
|
||||
private JDialog dialog;
|
||||
|
||||
private boolean registered;
|
||||
private XMPPConnection con = null;
|
||||
private JProgressBar bar;
|
||||
|
||||
|
||||
public AccountCreationWizard() {
|
||||
// Associate Mnemonics
|
||||
ResourceUtils.resLabel(usernameLabel, usernameField, "&Username:");
|
||||
ResourceUtils.resLabel(passwordLabel, passwordField, "&Password:");
|
||||
ResourceUtils.resLabel(confirmPasswordLabel, confirmPasswordField, "&Confirm Password:");
|
||||
ResourceUtils.resLabel(serverLabel, serverField, "&Server:");
|
||||
ResourceUtils.resButton(createAccountButton, "&Create Account");
|
||||
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
// Add component to UI
|
||||
add(usernameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(usernameField, new GridBagConstraints(1, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 150, 0));
|
||||
|
||||
add(passwordLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(passwordField, new GridBagConstraints(1, 1, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(confirmPasswordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(confirmPasswordField, new GridBagConstraints(1, 2, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(serverLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(serverField, new GridBagConstraints(1, 3, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
bar = new JProgressBar();
|
||||
|
||||
|
||||
add(bar, new GridBagConstraints(1, 4, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
bar.setVisible(false);
|
||||
add(createAccountButton, new GridBagConstraints(2, 5, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
|
||||
ResourceUtils.resButton(closeButton, "&Close");
|
||||
add(closeButton, new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
|
||||
createAccountButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
createAccount();
|
||||
}
|
||||
});
|
||||
|
||||
closeButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
dialog.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return usernameField.getText();
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return new String(passwordField.getPassword());
|
||||
}
|
||||
|
||||
public String getConfirmPassword() {
|
||||
return new String(confirmPasswordField.getPassword());
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return serverField.getText();
|
||||
}
|
||||
|
||||
public boolean passwordsMatch() {
|
||||
return getPassword().equals(getConfirmPassword());
|
||||
}
|
||||
|
||||
public void createAccount() {
|
||||
boolean errors = false;
|
||||
String errorMessage = "";
|
||||
|
||||
if (!ModelUtil.hasLength(getUsername())) {
|
||||
errors = true;
|
||||
usernameField.requestFocus();
|
||||
errorMessage = "Please specify a username for the account.";
|
||||
}
|
||||
else if (!ModelUtil.hasLength(getPassword())) {
|
||||
errors = true;
|
||||
errorMessage = "Please specify a password for this account.";
|
||||
}
|
||||
else if (!ModelUtil.hasLength(getConfirmPassword())) {
|
||||
errors = true;
|
||||
errorMessage = "Please specify a confirmation password.";
|
||||
}
|
||||
else if (!ModelUtil.hasLength(getServer())) {
|
||||
errors = true;
|
||||
errorMessage = "Please specify the server to create the account on.";
|
||||
}
|
||||
else if (!passwordsMatch()) {
|
||||
errors = true;
|
||||
errorMessage = "The passwords do not match. Please confirm passwords.";
|
||||
}
|
||||
|
||||
if (errors) {
|
||||
JOptionPane.showMessageDialog(this, errorMessage, "Account Creation Problem", JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
final Component ui = this;
|
||||
bar.setIndeterminate(true);
|
||||
bar.setStringPainted(true);
|
||||
bar.setString("Registering with " + getServer() + ". Please wait...");
|
||||
bar.setVisible(true);
|
||||
final SwingWorker worker = new SwingWorker() {
|
||||
int errorCode;
|
||||
|
||||
|
||||
public Object construct() {
|
||||
try {
|
||||
createAccountButton.setEnabled(false);
|
||||
con = getConnection();
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
return e;
|
||||
}
|
||||
try {
|
||||
final AccountManager accountManager = new AccountManager(con);
|
||||
accountManager.createAccount(getUsername(), getPassword());
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
errorCode = e.getXMPPError().getCode();
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public void finished() {
|
||||
bar.setVisible(false);
|
||||
if (con == null) {
|
||||
if (ui.isShowing()) {
|
||||
createAccountButton.setEnabled(true);
|
||||
JOptionPane.showMessageDialog(ui, "Unable to connect to " + getServer() + ".", "Account Creation Problem", JOptionPane.ERROR_MESSAGE);
|
||||
createAccountButton.setEnabled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (errorCode == 0) {
|
||||
accountCreationSuccessful();
|
||||
}
|
||||
else {
|
||||
accountCreationFailed(errorCode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
worker.start();
|
||||
}
|
||||
|
||||
private void accountCreationFailed(int errorCode) {
|
||||
String message = "Unable to create account.";
|
||||
if (errorCode == 409) {
|
||||
message = "Account already exists. Please specify different username.";
|
||||
usernameField.setText("");
|
||||
usernameField.requestFocus();
|
||||
}
|
||||
JOptionPane.showMessageDialog(this, message, "Account Creation Problem", JOptionPane.ERROR_MESSAGE);
|
||||
createAccountButton.setEnabled(true);
|
||||
}
|
||||
|
||||
private void accountCreationSuccessful() {
|
||||
registered = true;
|
||||
JOptionPane.showMessageDialog(this, "New Account has been created.", "Account Created", JOptionPane.INFORMATION_MESSAGE);
|
||||
dialog.dispose();
|
||||
}
|
||||
|
||||
public void invoke(JFrame parent) {
|
||||
dialog = new JDialog(parent, "Create New Account", true);
|
||||
|
||||
TitlePanel titlePanel = new TitlePanel("Account Registration", "Register a new account to chat", null, true);
|
||||
dialog.getContentPane().setLayout(new BorderLayout());
|
||||
dialog.getContentPane().add(titlePanel, BorderLayout.NORTH);
|
||||
dialog.getContentPane().add(this, BorderLayout.CENTER);
|
||||
dialog.pack();
|
||||
dialog.setSize(400, 300);
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
private XMPPConnection getConnection() throws XMPPException {
|
||||
LocalPreferences localPref = SettingsManager.getLocalPreferences();
|
||||
XMPPConnection con = null;
|
||||
|
||||
// Get connection
|
||||
|
||||
int port = localPref.getXmppPort();
|
||||
|
||||
String serverName = getServer();
|
||||
|
||||
int checkForPort = serverName.indexOf(":");
|
||||
if (checkForPort != -1) {
|
||||
String portString = serverName.substring(checkForPort + 1);
|
||||
if (ModelUtil.hasLength(portString)) {
|
||||
// Set new port.
|
||||
port = Integer.valueOf(portString).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
boolean useSSL = localPref.isSSL();
|
||||
boolean hostPortConfigured = localPref.isHostAndPortConfigured();
|
||||
|
||||
if (useSSL) {
|
||||
if (!hostPortConfigured) {
|
||||
con = new SSLXMPPConnection(serverName);
|
||||
}
|
||||
else {
|
||||
con = new SSLXMPPConnection(localPref.getXmppHost(), port, serverName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!hostPortConfigured) {
|
||||
con = new XMPPConnection(serverName);
|
||||
}
|
||||
else {
|
||||
con = new XMPPConnection(localPref.getXmppHost(), port, serverName);
|
||||
}
|
||||
}
|
||||
return con;
|
||||
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
}
|
||||
|
||||
69
src/java/org/jivesoftware/Installer.java
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import com.install4j.api.InstallAction;
|
||||
import com.install4j.api.InstallerWizardContext;
|
||||
import com.install4j.api.ProgressInterface;
|
||||
import com.install4j.api.UserCanceledException;
|
||||
import com.install4j.api.windows.WinRegistry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Installer extends InstallAction {
|
||||
|
||||
private InstallerWizardContext context;
|
||||
|
||||
public int getPercentOfTotalInstallation() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean performAction(InstallerWizardContext installerWizardContext, ProgressInterface progressInterface) throws UserCanceledException {
|
||||
context = installerWizardContext;
|
||||
|
||||
final String osName = System.getProperty("os.name");
|
||||
if (!osName.startsWith("Windows")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
addStartup(installerWizardContext.getInstallationDirectory());
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addStartup(File dir) {
|
||||
File jivec = new File(dir, "Spark.exe");
|
||||
String path = jivec.getAbsolutePath();
|
||||
WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", path);
|
||||
|
||||
addURIMapping(dir);
|
||||
}
|
||||
|
||||
private void addURIMapping(File dir) {
|
||||
File jivec = new File(dir, "Spark.exe");
|
||||
String path = jivec.getAbsolutePath();
|
||||
|
||||
boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
|
||||
if (exists) {
|
||||
}
|
||||
// JOptionPane.showConfirmDialog(null, "Another application is currently registered to handle XMPP instant messaging. Make Spark the default XMPP instant messaging client?", "Confirmation", }
|
||||
WinRegistry.deleteKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", true);
|
||||
|
||||
WinRegistry.createKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
|
||||
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", "", "URL:XMPP Address");
|
||||
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", "URL Protocol", "");
|
||||
|
||||
WinRegistry.createKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command");
|
||||
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command", "", path + " %1");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
818
src/java/org/jivesoftware/LoginDialog.java
Normal file
@ -0,0 +1,818 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.SSLXMPPConnection;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.spark.SessionManager;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.Workspace;
|
||||
import org.jivesoftware.spark.component.RolloverButton;
|
||||
import org.jivesoftware.spark.util.Encryptor;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettingsManager;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
/**
|
||||
* Dialog to log in a user into the Spark Server. The LoginDialog is used only
|
||||
* for login in registered users into the Spark Server.
|
||||
*/
|
||||
public final class LoginDialog {
|
||||
private JFrame loginDialog;
|
||||
private static final String BUTTON_PANEL = "buttonpanel"; // NOTRANS
|
||||
private static final String PROGRESS_BAR = "progressbar"; // NOTRANS
|
||||
private LocalPreferences localPref;
|
||||
// private TrayIcon trayIcon;
|
||||
// private SystemTray tray;
|
||||
|
||||
/**
|
||||
* Empty Constructor
|
||||
*/
|
||||
public LoginDialog() {
|
||||
localPref = SettingsManager.getLocalPreferences();
|
||||
|
||||
// Remove all Spark Tray issues on startup. This will increase timeouts of spark.
|
||||
|
||||
/*
|
||||
if (Spark.isWindows()) {
|
||||
try {
|
||||
tray = SystemTray.getDefaultSystemTray();
|
||||
trayIcon = new TrayIcon(LaRes.getImageIcon(LaRes.MAIN_IMAGE));
|
||||
trayIcon.setToolTip(Default.getString(Default.APPLICATION_NAME));
|
||||
trayIcon.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (loginDialog != null) {
|
||||
if (loginDialog.isVisible()) {
|
||||
loginDialog.setVisible(false);
|
||||
}
|
||||
else {
|
||||
loginDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (localPref.isStartedHidden() || localPref.isAutoLogin()) {
|
||||
tray.addTrayIcon(trayIcon);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the LoginDialog to be visible.
|
||||
*
|
||||
* @param parentFrame the parentFrame of the Login Dialog. This is used
|
||||
* for correct parenting.
|
||||
*/
|
||||
public void invoke(JFrame parentFrame) {
|
||||
// Before creating any connections. Update proxy if needed.
|
||||
updateProxyConfig();
|
||||
|
||||
LoginPanel loginPanel = new LoginPanel();
|
||||
|
||||
// Construct Dialog
|
||||
loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME));
|
||||
loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage());
|
||||
|
||||
final JPanel mainPanel = new GrayBackgroundPanel();
|
||||
final GridBagLayout mainLayout = new GridBagLayout();
|
||||
mainPanel.setLayout(mainLayout);
|
||||
|
||||
final ImagePanel imagePanel = new ImagePanel();
|
||||
|
||||
mainPanel.add(imagePanel,
|
||||
new GridBagConstraints(0, 0, 4, 1,
|
||||
1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
|
||||
final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY);
|
||||
if (ModelUtil.hasLength(showPoweredBy) && "true".equals(showPoweredBy)) {
|
||||
// Handle PoweredBy for custom clients.
|
||||
final JLabel poweredBy = new JLabel(SparkRes.getImageIcon(SparkRes.POWERED_BY_IMAGE));
|
||||
mainPanel.add(poweredBy,
|
||||
new GridBagConstraints(0, 1, 4, 1,
|
||||
1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(0, 0, 2, 0), 0, 0));
|
||||
|
||||
}
|
||||
imagePanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.lightGray));
|
||||
|
||||
loginPanel.setOpaque(false);
|
||||
mainPanel.add(loginPanel,
|
||||
new GridBagConstraints(0, 2, 2, 1,
|
||||
1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
|
||||
loginDialog.setContentPane(mainPanel);
|
||||
loginDialog.setLocationRelativeTo(parentFrame);
|
||||
|
||||
loginDialog.setResizable(false);
|
||||
loginDialog.pack();
|
||||
|
||||
// Center dialog on screen
|
||||
GraphicUtils.centerWindowOnScreen(loginDialog);
|
||||
|
||||
// Show dialog
|
||||
loginDialog.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
quitLogin();
|
||||
}
|
||||
});
|
||||
if (loginPanel.getUsername().trim().length() > 0) {
|
||||
loginPanel.getPasswordField().requestFocus();
|
||||
}
|
||||
|
||||
if (!localPref.isStartedHidden() || !localPref.isAutoLogin()) {
|
||||
// Make dialog top most.
|
||||
loginDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define Login Panel implementation.
|
||||
*/
|
||||
private final class LoginPanel extends JPanel implements KeyListener, ActionListener, FocusListener {
|
||||
private final JLabel usernameLabel = new JLabel();
|
||||
private final JTextField usernameField = new JTextField();
|
||||
|
||||
private final JLabel passwordLabel = new JLabel();
|
||||
private final JPasswordField passwordField = new JPasswordField();
|
||||
|
||||
private final JLabel serverLabel = new JLabel();
|
||||
private final JTextField serverField = new JTextField();
|
||||
|
||||
private final JCheckBox savePasswordBox = new JCheckBox();
|
||||
private final JCheckBox autoLoginBox = new JCheckBox();
|
||||
private final RolloverButton loginButton = new RolloverButton();
|
||||
private final RolloverButton connectionButton = new RolloverButton();
|
||||
private final RolloverButton quitButton = new RolloverButton();
|
||||
|
||||
private final RolloverButton createAccountButton = new RolloverButton();
|
||||
|
||||
private final JLabel progressBar = new JLabel();
|
||||
|
||||
// Panel used to hold buttons
|
||||
private final CardLayout cardLayout = new CardLayout(0, 5);
|
||||
final JPanel cardPanel = new JPanel(cardLayout);
|
||||
|
||||
final JPanel buttonPanel = new JPanel(new GridBagLayout());
|
||||
private final GridBagLayout GRIDBAGLAYOUT = new GridBagLayout();
|
||||
private XMPPConnection connection = null;
|
||||
|
||||
|
||||
LoginPanel() {
|
||||
//setBorder(BorderFactory.createTitledBorder("Sign In Now"));
|
||||
ResourceUtils.resButton(savePasswordBox, "Save &Password");
|
||||
ResourceUtils.resButton(autoLoginBox, "&Auto Login");
|
||||
ResourceUtils.resLabel(serverLabel, serverField, "&Server:");
|
||||
ResourceUtils.resButton(createAccountButton, "&Accounts");
|
||||
|
||||
savePasswordBox.setOpaque(false);
|
||||
autoLoginBox.setOpaque(false);
|
||||
setLayout(GRIDBAGLAYOUT);
|
||||
|
||||
|
||||
add(usernameLabel,
|
||||
new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 5, 5), 0, 0));
|
||||
add(usernameField,
|
||||
new GridBagConstraints(1, 1, 2, 1,
|
||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(15, 5, 5, 5), 0, 0));
|
||||
|
||||
add(passwordField,
|
||||
new GridBagConstraints(1, 2, 2, 1,
|
||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(0, 5, 5, 5), 0, 0));
|
||||
add(passwordLabel,
|
||||
new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0));
|
||||
|
||||
// Add Server Field Properties
|
||||
add(serverField,
|
||||
new GridBagConstraints(1, 4, 2, 1,
|
||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(0, 5, 5, 5), 0, 0));
|
||||
add(serverLabel,
|
||||
new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0));
|
||||
|
||||
|
||||
add(savePasswordBox,
|
||||
new GridBagConstraints(0, 5, 2, 1, 1.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
|
||||
add(autoLoginBox,
|
||||
new GridBagConstraints(0, 6, 2, 1, 1.0, 0.0,
|
||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
|
||||
|
||||
// Add button but disable the login button initially
|
||||
savePasswordBox.addActionListener(this);
|
||||
autoLoginBox.addActionListener(this);
|
||||
|
||||
buttonPanel.add(quitButton,
|
||||
new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
|
||||
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
|
||||
|
||||
if (!"true".equals(Default.getString(Default.ACCOUNT_DISABLED))) {
|
||||
buttonPanel.add(createAccountButton,
|
||||
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
|
||||
}
|
||||
buttonPanel.add(connectionButton,
|
||||
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
|
||||
buttonPanel.add(loginButton,
|
||||
new GridBagConstraints(3, 0, 4, 1, 0.0, 0.0,
|
||||
GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 0), 0, 0));
|
||||
|
||||
cardPanel.add(buttonPanel, BUTTON_PANEL);
|
||||
|
||||
cardPanel.setOpaque(false);
|
||||
buttonPanel.setOpaque(false);
|
||||
|
||||
progressBar.setHorizontalAlignment(JLabel.CENTER);
|
||||
cardPanel.add(progressBar, PROGRESS_BAR);
|
||||
|
||||
add(cardPanel,
|
||||
new GridBagConstraints(0, 7, 4, 1,
|
||||
1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(5, 5, 5, 5), 0, 0));
|
||||
loginButton.setEnabled(false);
|
||||
|
||||
// Add KeyListener
|
||||
usernameField.addKeyListener(this);
|
||||
passwordField.addKeyListener(this);
|
||||
serverField.addKeyListener(this);
|
||||
|
||||
passwordField.addFocusListener(this);
|
||||
usernameField.addFocusListener(this);
|
||||
serverField.addFocusListener(this);
|
||||
|
||||
// Add ActionListener
|
||||
quitButton.addActionListener(this);
|
||||
loginButton.addActionListener(this);
|
||||
connectionButton.addActionListener(this);
|
||||
|
||||
// Make same size
|
||||
GraphicUtils.makeSameSize(new JComponent[]{usernameField, passwordField});
|
||||
|
||||
// Set progress bar description
|
||||
progressBar.setText(SparkRes.getString(SparkRes.LOGIN_DIALOG_AUTHENTICATING));
|
||||
//progressBar.setStringPainted(true);
|
||||
|
||||
// Set Resources
|
||||
ResourceUtils.resLabel(usernameLabel, usernameField, SparkRes.getString(SparkRes.LOGIN_DIALOG_USERNAME));
|
||||
ResourceUtils.resLabel(passwordLabel, passwordField, SparkRes.getString(SparkRes.LOGIN_DIALOG_PASSWORD));
|
||||
ResourceUtils.resButton(quitButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_QUIT));
|
||||
ResourceUtils.resButton(loginButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_LOGIN));
|
||||
ResourceUtils.resButton(connectionButton, "Ad&vanced");
|
||||
|
||||
// Load previous instances
|
||||
String userProp = localPref.getUsername();
|
||||
String serverProp = localPref.getServer();
|
||||
|
||||
if (userProp != null && serverProp != null) {
|
||||
usernameField.setText(userProp);
|
||||
serverField.setText(serverProp);
|
||||
}
|
||||
|
||||
// Check Settings
|
||||
if (localPref.isSavePassword()) {
|
||||
String encryptedPassword = localPref.getPassword();
|
||||
if (encryptedPassword != null) {
|
||||
String password = Encryptor.decrypt(encryptedPassword);
|
||||
passwordField.setText(password);
|
||||
}
|
||||
savePasswordBox.setSelected(true);
|
||||
loginButton.setEnabled(true);
|
||||
}
|
||||
autoLoginBox.setSelected(localPref.isAutoLogin());
|
||||
if (autoLoginBox.isSelected()) {
|
||||
savePasswordBox.setEnabled(false);
|
||||
autoLoginBox.setEnabled(false);
|
||||
validateLogin();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle arguments
|
||||
String username = Spark.getArgumentValue("username");
|
||||
String password = Spark.getArgumentValue("password");
|
||||
String server = Spark.getArgumentValue("server");
|
||||
|
||||
if (username != null) {
|
||||
usernameField.setText(username);
|
||||
}
|
||||
|
||||
if (password != null) {
|
||||
passwordField.setText(password);
|
||||
}
|
||||
|
||||
if (server != null) {
|
||||
serverField.setText(server);
|
||||
}
|
||||
|
||||
if (username != null && server != null && password != null) {
|
||||
savePasswordBox.setEnabled(false);
|
||||
autoLoginBox.setEnabled(false);
|
||||
validateLogin();
|
||||
}
|
||||
|
||||
createAccountButton.addActionListener(this);
|
||||
|
||||
final String lockedDownURL = Default.getString(Default.HOST_NAME);
|
||||
if (ModelUtil.hasLength(lockedDownURL)) {
|
||||
serverField.setEnabled(false);
|
||||
serverField.setText(lockedDownURL);
|
||||
}
|
||||
}
|
||||
|
||||
private String getUsername() {
|
||||
return usernameField.getText().trim();
|
||||
}
|
||||
|
||||
private String getPassword() {
|
||||
return new String(passwordField.getPassword()).trim();
|
||||
}
|
||||
|
||||
private String getServerName() {
|
||||
return serverField.getText().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* ActionListener implementation.
|
||||
*
|
||||
* @param e the ActionEvent
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
if (e.getSource() == quitButton) {
|
||||
quitLogin();
|
||||
}
|
||||
else if (e.getSource() == createAccountButton) {
|
||||
AccountCreationWizard createAccountPanel = new AccountCreationWizard();
|
||||
createAccountPanel.invoke(loginDialog);
|
||||
|
||||
if (createAccountPanel.isRegistered()) {
|
||||
usernameField.setText(createAccountPanel.getUsername());
|
||||
passwordField.setText(createAccountPanel.getPassword());
|
||||
serverField.setText(createAccountPanel.getServer());
|
||||
loginButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
else if (e.getSource() == loginButton) {
|
||||
validateLogin();
|
||||
}
|
||||
else if (e.getSource() == connectionButton) {
|
||||
final LoginSettingDialog loginSettingsDialog = new LoginSettingDialog();
|
||||
loginSettingsDialog.invoke(loginDialog);
|
||||
}
|
||||
else if (e.getSource() == savePasswordBox) {
|
||||
autoLoginBox.setEnabled(savePasswordBox.isSelected());
|
||||
|
||||
if (!savePasswordBox.isSelected()) {
|
||||
autoLoginBox.setSelected(false);
|
||||
}
|
||||
}
|
||||
else if (e.getSource() == autoLoginBox) {
|
||||
if (autoLoginBox.isSelected()) {
|
||||
savePasswordBox.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* KeyListener implementation.
|
||||
*
|
||||
* @param e the KeyEvent to process.
|
||||
*/
|
||||
public void keyTyped(KeyEvent e) {
|
||||
validate(e);
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
public void keyReleased(KeyEvent e) {
|
||||
validateDialog();
|
||||
}
|
||||
|
||||
private void validateDialog() {
|
||||
loginButton.setEnabled(ModelUtil.hasLength(getUsername()) && ModelUtil.hasLength(getPassword())
|
||||
&& ModelUtil.hasLength(getServerName()));
|
||||
}
|
||||
|
||||
private void validate(KeyEvent e) {
|
||||
if (loginButton.isEnabled() && e.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||
validateLogin();
|
||||
}
|
||||
}
|
||||
|
||||
public void focusGained(FocusEvent e) {
|
||||
Object o = e.getSource();
|
||||
if (o instanceof JTextComponent) {
|
||||
((JTextComponent)o).selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent e) {
|
||||
}
|
||||
|
||||
private void enableComponents(boolean editable) {
|
||||
|
||||
// Need to set both editable and enabled for best behavior.
|
||||
usernameField.setEditable(editable);
|
||||
usernameField.setEnabled(editable);
|
||||
|
||||
passwordField.setEditable(editable);
|
||||
passwordField.setEnabled(editable);
|
||||
|
||||
serverField.setEditable(editable);
|
||||
serverField.setEnabled(editable);
|
||||
|
||||
if (editable) {
|
||||
|
||||
// Reapply focus to username field
|
||||
passwordField.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
private void showProgressBar(boolean show) {
|
||||
if (show) {
|
||||
cardLayout.show(cardPanel, PROGRESS_BAR);
|
||||
// progressBar.setIndeterminate(true);
|
||||
}
|
||||
else {
|
||||
cardLayout.show(cardPanel, BUTTON_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLogin() {
|
||||
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
public Object construct() {
|
||||
|
||||
boolean loginSuccessfull = login();
|
||||
if (loginSuccessfull) {
|
||||
progressBar.setText("Connecting. Please wait...");
|
||||
|
||||
// Startup Spark
|
||||
startSpark();
|
||||
|
||||
// dispose login dialog
|
||||
loginDialog.dispose();
|
||||
|
||||
// Show ChangeLog if we need to.
|
||||
// new ChangeLogDialog().showDialog();
|
||||
}
|
||||
else {
|
||||
savePasswordBox.setEnabled(true);
|
||||
autoLoginBox.setEnabled(true);
|
||||
enableComponents(true);
|
||||
showProgressBar(false);
|
||||
}
|
||||
return Boolean.valueOf(loginSuccessfull);
|
||||
}
|
||||
};
|
||||
|
||||
// Start the login process in seperate thread.
|
||||
// Disable textfields
|
||||
enableComponents(false);
|
||||
|
||||
// Show progressbar
|
||||
showProgressBar(true);
|
||||
|
||||
worker.start();
|
||||
}
|
||||
|
||||
public JPasswordField getPasswordField() {
|
||||
return passwordField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login to the specified server using username, password, and workgroup.
|
||||
* Handles error representation as well as logging.
|
||||
*
|
||||
* @return true if login was successful, false otherwise
|
||||
*/
|
||||
private boolean login() {
|
||||
final SessionManager sessionManager = SparkManager.getSessionManager();
|
||||
|
||||
boolean hasErrors = false;
|
||||
String errorMessage = null;
|
||||
|
||||
// Handle specifyed Workgroup
|
||||
String serverName = getServerName();
|
||||
|
||||
if (!hasErrors) {
|
||||
localPref = SettingsManager.getLocalPreferences();
|
||||
|
||||
SmackConfiguration.setPacketReplyTimeout(localPref.getTimeOut() * 1000);
|
||||
|
||||
// Get connection
|
||||
try {
|
||||
int port = localPref.getXmppPort();
|
||||
|
||||
int checkForPort = serverName.indexOf(":");
|
||||
if (checkForPort != -1) {
|
||||
String portString = serverName.substring(checkForPort + 1);
|
||||
if (ModelUtil.hasLength(portString)) {
|
||||
// Set new port.
|
||||
port = Integer.valueOf(portString).intValue();
|
||||
}
|
||||
}
|
||||
|
||||
boolean useSSL = localPref.isSSL();
|
||||
boolean hostPortConfigured = localPref.isHostAndPortConfigured();
|
||||
|
||||
if (useSSL) {
|
||||
if (!hostPortConfigured) {
|
||||
connection = new SSLXMPPConnection(serverName);
|
||||
}
|
||||
else {
|
||||
connection = new SSLXMPPConnection(localPref.getXmppHost(), port, serverName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!hostPortConfigured) {
|
||||
connection = new XMPPConnection(serverName);
|
||||
}
|
||||
else {
|
||||
connection = new XMPPConnection(localPref.getXmppHost(), port, serverName);
|
||||
}
|
||||
}
|
||||
|
||||
String resource = localPref.getResource();
|
||||
if (!ModelUtil.hasLength(resource)) {
|
||||
resource = "spark";
|
||||
}
|
||||
connection.login(getUsername(), getPassword(), resource, false);
|
||||
|
||||
// Subscriptions are always manual
|
||||
Roster roster = connection.getRoster();
|
||||
roster.setSubscriptionMode(Roster.SUBSCRIPTION_MANUAL);
|
||||
|
||||
sessionManager.setServerAddress(connection.getServiceName());
|
||||
sessionManager.initializeSession(connection, getUsername(), getPassword());
|
||||
final String jid = getUsername() + '@' + sessionManager.getServerAddress() + "/" + resource;
|
||||
sessionManager.setJID(jid);
|
||||
|
||||
}
|
||||
catch (Exception xee) {
|
||||
if (xee instanceof XMPPException) {
|
||||
XMPPException xe = (XMPPException)xee;
|
||||
final XMPPError error = xe.getXMPPError();
|
||||
int errorCode = 0;
|
||||
if (error != null) {
|
||||
errorCode = error.getCode();
|
||||
}
|
||||
if (errorCode == 401) {
|
||||
errorMessage = SparkRes.getString(SparkRes.INVALID_USERNAME_PASSWORD);
|
||||
}
|
||||
else if (errorCode == 502 || errorCode == 504) {
|
||||
errorMessage = SparkRes.getString(SparkRes.SERVER_UNAVAILABLE);
|
||||
}
|
||||
else {
|
||||
errorMessage = SparkRes.getString(SparkRes.UNRECOVERABLE_ERROR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorMessage = SparkRes.getString(SparkRes.UNRECOVERABLE_ERROR);
|
||||
}
|
||||
|
||||
// Log Error
|
||||
Log.warning("Exception in Login:", xee);
|
||||
hasErrors = true;
|
||||
}
|
||||
}
|
||||
if (hasErrors) {
|
||||
progressBar.setVisible(false);
|
||||
//progressBar.setIndeterminate(false);
|
||||
|
||||
// Show error dialog
|
||||
if (!localPref.isStartedHidden() || !localPref.isAutoLogin()) {
|
||||
|
||||
JOptionPane.showMessageDialog(loginDialog, errorMessage, SparkRes.getString(SparkRes.ERROR_DIALOG_TITLE),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
}
|
||||
setEnabled(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Since the connection and workgroup are valid. Add a ConnectionListener
|
||||
connection.addConnectionListener(SparkManager.getSessionManager());
|
||||
|
||||
// Persist information
|
||||
localPref.setUsername(getUsername());
|
||||
|
||||
String encodedPassword = null;
|
||||
try {
|
||||
encodedPassword = Encryptor.encrypt(getPassword());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("Error encrypting password.", e);
|
||||
}
|
||||
localPref.setPassword(encodedPassword);
|
||||
localPref.setSavePassword(savePasswordBox.isSelected());
|
||||
localPref.setAutoLogin(autoLoginBox.isSelected());
|
||||
localPref.setServer(serverField.getText());
|
||||
|
||||
|
||||
SettingsManager.saveSettings();
|
||||
|
||||
return !hasErrors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user quits, just shut down the
|
||||
* application.
|
||||
*/
|
||||
private void quitLogin() {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes Spark and initializes all plugins.
|
||||
*/
|
||||
private void startSpark() {
|
||||
// Invoke the MainWindow.
|
||||
final MainWindow mainWindow = MainWindow.getInstance();
|
||||
|
||||
/*
|
||||
if (tray != null) {
|
||||
// Remove trayIcon
|
||||
tray.removeTrayIcon(trayIcon);
|
||||
}
|
||||
*/
|
||||
// Creates the Spark Workspace and add to MainWindow
|
||||
Workspace workspace = Workspace.getInstance();
|
||||
|
||||
|
||||
mainWindow.getContentPane().add(workspace, BorderLayout.CENTER);
|
||||
|
||||
mainWindow.pack();
|
||||
|
||||
LayoutSettings settings = LayoutSettingsManager.getLayoutSettings();
|
||||
int x = settings.getMainWindowX();
|
||||
int y = settings.getMainWindowY();
|
||||
int width = settings.getMainWindowWidth();
|
||||
int height = settings.getMainWindowHeight();
|
||||
|
||||
if (x == 0 && y == 0) {
|
||||
// Use Default size
|
||||
mainWindow.setSize(310, 520);
|
||||
|
||||
// Center Window on Screen
|
||||
GraphicUtils.centerWindowOnScreen(mainWindow);
|
||||
}
|
||||
else {
|
||||
mainWindow.setBounds(x, y, width, height);
|
||||
}
|
||||
|
||||
if (loginDialog.isVisible()) {
|
||||
mainWindow.setVisible(true);
|
||||
}
|
||||
|
||||
loginDialog.setVisible(false);
|
||||
|
||||
// Build the layout in the workspace
|
||||
workspace.buildLayout();
|
||||
}
|
||||
|
||||
private void updateProxyConfig() {
|
||||
if (ModelUtil.hasLength(Default.getString(Default.PROXY_PORT)) && ModelUtil.hasLength(Default.getString(Default.PROXY_HOST))) {
|
||||
String port = Default.getString(Default.PROXY_PORT);
|
||||
String host = Default.getString(Default.PROXY_HOST);
|
||||
System.setProperty("socksProxyHost", host);
|
||||
System.setProperty("socksProxyPort", port);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean proxyEnabled = localPref.isProxyEnabled();
|
||||
if (proxyEnabled) {
|
||||
String host = localPref.getHost();
|
||||
String port = localPref.getPort();
|
||||
String username = localPref.getProxyUsername();
|
||||
String password = localPref.getProxyPassword();
|
||||
String protocol = localPref.getProtocol();
|
||||
|
||||
if (protocol.equals("SOCKS")) {
|
||||
System.setProperty("socksProxyHost", host);
|
||||
System.setProperty("socksProxyPort", port);
|
||||
}
|
||||
else {
|
||||
System.setProperty("http.proxyHost", host);
|
||||
System.setProperty("http.proxyPort", port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GrayBackgroundPanel extends JPanel {
|
||||
final ImageIcon icons = Default.getImageIcon(Default.LOGIN_DIALOG_BACKGROUND_IMAGE);
|
||||
|
||||
public GrayBackgroundPanel() {
|
||||
|
||||
}
|
||||
|
||||
public GrayBackgroundPanel(LayoutManager layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Image backgroundImage = icons.getImage();
|
||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||
}
|
||||
}
|
||||
|
||||
public class ImagePanel extends JPanel {
|
||||
final ImageIcon icons = Default.getImageIcon(Default.MAIN_IMAGE);
|
||||
|
||||
public ImagePanel() {
|
||||
|
||||
}
|
||||
|
||||
public ImagePanel(LayoutManager layout) {
|
||||
super(layout);
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Image backgroundImage = icons.getImage();
|
||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
final Dimension size = super.getPreferredSize();
|
||||
size.width = icons.getIconWidth();
|
||||
size.height = icons.getIconHeight();
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
427
src/java/org/jivesoftware/LoginSettingDialog.java
Normal file
@ -0,0 +1,427 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.spark.component.TitlePanel;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Allows users to configure startup options.
|
||||
*/
|
||||
public class LoginSettingDialog implements PropertyChangeListener {
|
||||
private JOptionPane optionPane;
|
||||
private JDialog optionsDialog;
|
||||
|
||||
private TitlePanel titlePanel;
|
||||
|
||||
private JCheckBox autoDiscoverBox = new JCheckBox();
|
||||
|
||||
private JLabel portLabel = new JLabel();
|
||||
private JTextField portField = new JTextField();
|
||||
|
||||
private JLabel xmppHostLabel = new JLabel();
|
||||
private JTextField xmppHostField = new JTextField();
|
||||
|
||||
private JLabel timeOutLabel = new JLabel();
|
||||
private JTextField timeOutField = new JTextField();
|
||||
|
||||
private JLabel resourceLabel = new JLabel();
|
||||
private JTextField resourceField = new JTextField();
|
||||
|
||||
private JCheckBox autoLoginBox = new JCheckBox();
|
||||
|
||||
|
||||
private JCheckBox useSSLBox = new JCheckBox();
|
||||
private JLabel sslLabel = new JLabel();
|
||||
|
||||
private LocalPreferences localPreferences;
|
||||
|
||||
private ProxyPanel proxyPanel;
|
||||
|
||||
/**
|
||||
* Empty Constructor.
|
||||
*/
|
||||
public LoginSettingDialog() {
|
||||
localPreferences = SettingsManager.getLocalPreferences();
|
||||
proxyPanel = new ProxyPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the OptionsDialog.
|
||||
*
|
||||
* @param owner the parent owner of this dialog. This is used for correct parenting.
|
||||
* @return true if the options have been changed.
|
||||
*/
|
||||
public boolean invoke(JFrame owner) {
|
||||
// Load local localPref
|
||||
JTabbedPane tabbedPane = new JTabbedPane();
|
||||
|
||||
portField.setText(Integer.toString(localPreferences.getXmppPort()));
|
||||
timeOutField.setText(Integer.toString(localPreferences.getTimeOut()));
|
||||
autoLoginBox.setSelected(localPreferences.isAutoLogin());
|
||||
useSSLBox.setSelected(localPreferences.isSSL());
|
||||
xmppHostField.setText(localPreferences.getXmppHost());
|
||||
resourceField.setText(localPreferences.getResource());
|
||||
if (localPreferences.getResource() == null) {
|
||||
resourceField.setText("spark");
|
||||
}
|
||||
|
||||
final JPanel inputPanel = new JPanel();
|
||||
tabbedPane.addTab("General", inputPanel);
|
||||
tabbedPane.addTab("Proxy", proxyPanel);
|
||||
inputPanel.setLayout(new GridBagLayout());
|
||||
|
||||
ResourceUtils.resLabel(portLabel, portField, "&Port:");
|
||||
ResourceUtils.resLabel(timeOutLabel, timeOutField, "&Response Timeout (sec):");
|
||||
ResourceUtils.resButton(autoLoginBox, "&Auto Login");
|
||||
ResourceUtils.resLabel(sslLabel, useSSLBox, "&Use OLD SSL port method");
|
||||
ResourceUtils.resLabel(xmppHostLabel, xmppHostField, "&Host:");
|
||||
ResourceUtils.resButton(autoDiscoverBox, "&Automatically discover host and port");
|
||||
ResourceUtils.resLabel(resourceLabel, resourceField, "&Resource:");
|
||||
|
||||
inputPanel.add(autoDiscoverBox, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
autoDiscoverBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateAutoDiscovery();
|
||||
}
|
||||
});
|
||||
|
||||
autoDiscoverBox.setSelected(!localPreferences.isHostAndPortConfigured());
|
||||
updateAutoDiscovery();
|
||||
|
||||
final JPanel connectionPanel = new JPanel();
|
||||
connectionPanel.setLayout(new GridBagLayout());
|
||||
connectionPanel.setBorder(BorderFactory.createTitledBorder("Connection"));
|
||||
|
||||
connectionPanel.add(xmppHostLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
connectionPanel.add(xmppHostField, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 200, 0));
|
||||
|
||||
connectionPanel.add(portLabel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
connectionPanel.add(portField, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 50, 0));
|
||||
|
||||
inputPanel.add(connectionPanel, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
inputPanel.add(resourceLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
inputPanel.add(resourceField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
|
||||
|
||||
inputPanel.add(timeOutLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
inputPanel.add(timeOutField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 50, 0));
|
||||
|
||||
inputPanel.add(sslLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
|
||||
inputPanel.add(useSSLBox, new GridBagConstraints(1, 4, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
// Create the title panel for this dialog
|
||||
titlePanel = new TitlePanel("Advanced Connection Preferences", "", SparkRes.getImageIcon(SparkRes.BLANK_24x24), true);
|
||||
|
||||
// Construct main panel w/ layout.
|
||||
final JPanel mainPanel = new JPanel();
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
||||
|
||||
// The user should only be able to close this dialog.
|
||||
Object[] options = {"Ok", "Cancel", "Use Default"};
|
||||
optionPane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
||||
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
||||
|
||||
mainPanel.add(optionPane, BorderLayout.CENTER);
|
||||
|
||||
optionsDialog = new JDialog(owner, "Preference Window", true);
|
||||
optionsDialog.setContentPane(mainPanel);
|
||||
optionsDialog.pack();
|
||||
|
||||
|
||||
optionsDialog.setLocationRelativeTo(owner);
|
||||
optionPane.addPropertyChangeListener(this);
|
||||
|
||||
optionsDialog.setResizable(true);
|
||||
optionsDialog.setVisible(true);
|
||||
optionsDialog.toFront();
|
||||
optionsDialog.requestFocus();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* PropertyChangeEvent is called when the user either clicks the Cancel or
|
||||
* OK button.
|
||||
*
|
||||
* @param e the property change event.
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
String value = (String)optionPane.getValue();
|
||||
if ("Cancel".equals(value)) {
|
||||
optionsDialog.setVisible(false);
|
||||
}
|
||||
else if ("Ok".equals(value)) {
|
||||
String timeOut = timeOutField.getText();
|
||||
String port = portField.getText();
|
||||
String resource = resourceField.getText();
|
||||
|
||||
boolean errors = false;
|
||||
|
||||
try {
|
||||
Integer.valueOf(timeOut);
|
||||
}
|
||||
catch (NumberFormatException numberFormatException) {
|
||||
JOptionPane.showMessageDialog(optionsDialog, "You must supply a valid Time out value.",
|
||||
"Invalid Time Out", JOptionPane.ERROR_MESSAGE);
|
||||
timeOutField.requestFocus();
|
||||
errors = true;
|
||||
}
|
||||
|
||||
try {
|
||||
Integer.valueOf(port);
|
||||
}
|
||||
catch (NumberFormatException numberFormatException) {
|
||||
JOptionPane.showMessageDialog(optionsDialog, "You must supply a valid Port.",
|
||||
"Invalid Port", JOptionPane.ERROR_MESSAGE);
|
||||
portField.requestFocus();
|
||||
errors = true;
|
||||
}
|
||||
|
||||
if (!ModelUtil.hasLength(resource)) {
|
||||
JOptionPane.showMessageDialog(optionsDialog, "You must supply a resource",
|
||||
"Invalid Resource", JOptionPane.ERROR_MESSAGE);
|
||||
resourceField.requestFocus();
|
||||
errors = true;
|
||||
}
|
||||
|
||||
if (!errors) {
|
||||
localPreferences.setTimeOut(Integer.parseInt(timeOut));
|
||||
localPreferences.setXmppPort(Integer.parseInt(port));
|
||||
localPreferences.setSSL(useSSLBox.isSelected());
|
||||
localPreferences.setXmppHost(xmppHostField.getText());
|
||||
optionsDialog.setVisible(false);
|
||||
localPreferences.setResource(resource);
|
||||
proxyPanel.save();
|
||||
}
|
||||
else {
|
||||
optionPane.removePropertyChangeListener(this);
|
||||
optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
|
||||
optionPane.addPropertyChangeListener(this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
localPreferences.setTimeOut(30);
|
||||
localPreferences.setXmppPort(5222);
|
||||
localPreferences.setSSL(false);
|
||||
portField.setText("5222");
|
||||
timeOutField.setText("30");
|
||||
useSSLBox.setSelected(false);
|
||||
optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
private class ProxyPanel extends JPanel {
|
||||
private JCheckBox useProxyBox = new JCheckBox();
|
||||
private JComboBox protocolBox = new JComboBox();
|
||||
private JTextField hostField = new JTextField();
|
||||
private JTextField portField = new JTextField();
|
||||
private JTextField usernameField = new JTextField();
|
||||
private JPasswordField passwordField = new JPasswordField();
|
||||
|
||||
public ProxyPanel() {
|
||||
JLabel protocolLabel = new JLabel();
|
||||
JLabel hostLabel = new JLabel();
|
||||
JLabel portLabel = new JLabel();
|
||||
JLabel usernameLabel = new JLabel();
|
||||
JLabel passwordLabel = new JLabel();
|
||||
|
||||
protocolBox.addItem("SOCKS");
|
||||
protocolBox.addItem("HTTP");
|
||||
|
||||
// Add ResourceUtils
|
||||
ResourceUtils.resButton(useProxyBox, "&Use Proxy Server");
|
||||
ResourceUtils.resLabel(protocolLabel, protocolBox, "&Protocol:");
|
||||
ResourceUtils.resLabel(hostLabel, hostField, "&Host:");
|
||||
ResourceUtils.resLabel(portLabel, portField, "P&ort:");
|
||||
ResourceUtils.resLabel(usernameLabel, usernameField, "&Username:");
|
||||
ResourceUtils.resLabel(passwordLabel, passwordField, "P&assword:");
|
||||
|
||||
setLayout(new GridBagLayout());
|
||||
add(useProxyBox, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(protocolLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(protocolBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(hostLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(hostField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(portLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(portField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(usernameLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(usernameField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
add(passwordLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(passwordField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
|
||||
useProxyBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
enableFields(useProxyBox.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
// Check localSettings
|
||||
if (localPreferences.isProxyEnabled()) {
|
||||
useProxyBox.setSelected(true);
|
||||
}
|
||||
|
||||
enableFields(useProxyBox.isSelected());
|
||||
|
||||
if (ModelUtil.hasLength(localPreferences.getHost())) {
|
||||
hostField.setText(localPreferences.getHost());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(localPreferences.getPort())) {
|
||||
portField.setText(localPreferences.getPort());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(localPreferences.getProxyPassword())) {
|
||||
passwordField.setText(localPreferences.getProxyPassword());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(localPreferences.getProxyUsername())) {
|
||||
usernameField.setText(localPreferences.getProxyUsername());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(localPreferences.getProtocol())) {
|
||||
protocolBox.setSelectedItem(localPreferences.getProtocol());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void enableFields(boolean enable) {
|
||||
Component[] comps = getComponents();
|
||||
for (int i = 0; i < comps.length; i++) {
|
||||
if (comps[i] instanceof JTextField || comps[i] instanceof JComboBox) {
|
||||
JComponent comp = (JComponent)comps[i];
|
||||
comp.setEnabled(enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useProxy() {
|
||||
return useProxyBox.isSelected();
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return (String)protocolBox.getSelectedItem();
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return hostField.getText();
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return portField.getText();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return usernameField.getText();
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return new String(passwordField.getPassword());
|
||||
}
|
||||
|
||||
public void save() {
|
||||
localPreferences.setProxyEnabled(useProxyBox.isSelected());
|
||||
if (ModelUtil.hasLength(getProtocol())) {
|
||||
localPreferences.setProtocol(getProtocol());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(getHost())) {
|
||||
localPreferences.setHost(getHost());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(getPort())) {
|
||||
localPreferences.setPort(getPort());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(getUsername())) {
|
||||
localPreferences.setProxyUsername(getUsername());
|
||||
}
|
||||
|
||||
if (ModelUtil.hasLength(getPassword())) {
|
||||
localPreferences.setProxyPassword(getPassword());
|
||||
}
|
||||
|
||||
if (!localPreferences.isProxyEnabled()) {
|
||||
Properties props = System.getProperties();
|
||||
props.remove("socksProxyHost");
|
||||
props.remove("socksProxyPort");
|
||||
props.remove("http.proxyHost");
|
||||
props.remove("http.proxyPort");
|
||||
props.remove("http.proxySet");
|
||||
}
|
||||
else {
|
||||
String host = localPreferences.getHost();
|
||||
String port = localPreferences.getPort();
|
||||
String username = localPreferences.getProxyUsername();
|
||||
String password = localPreferences.getProxyPassword();
|
||||
String protocol = localPreferences.getProtocol();
|
||||
|
||||
if (protocol.equals("SOCKS")) {
|
||||
System.setProperty("socksProxyHost", host);
|
||||
System.setProperty("socksProxyPort", port);
|
||||
}
|
||||
else {
|
||||
System.setProperty("http.proxySet", "true");
|
||||
System.setProperty("http.proxyHost", host);
|
||||
System.setProperty("http.proxyPort", port);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsManager.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateAutoDiscovery() {
|
||||
boolean isSelected = autoDiscoverBox.isSelected();
|
||||
xmppHostField.setEnabled(!isSelected);
|
||||
portField.setEnabled(!isSelected);
|
||||
localPreferences.setHostAndPortConfigured(!isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
497
src/java/org/jivesoftware/MainWindow.java
Normal file
@ -0,0 +1,497 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.util.BrowserLauncher;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.JiveInfo;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
import org.jivesoftware.sparkimpl.updater.CheckUpdates;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowFocusListener;
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* The <code>MainWindow</code> class acts as both the DockableHolder and the proxy
|
||||
* to the Workspace in Spark.
|
||||
*
|
||||
* @version 1.0, 03/12/14
|
||||
*/
|
||||
public final class MainWindow extends JFrame implements ActionListener {
|
||||
private final Set<MainWindowListener> listeners = new HashSet<MainWindowListener>();
|
||||
|
||||
private final JMenu connectMenu = new JMenu();
|
||||
private final JMenu contactsMenu = new JMenu();
|
||||
private final JMenu actionsMenu = new JMenu();
|
||||
private final JMenu pluginsMenu = new JMenu();
|
||||
private final JMenu helpMenu = new JMenu();
|
||||
|
||||
private JMenuItem preferenceMenuItem;
|
||||
|
||||
private final JMenuItem menuAbout = new JMenuItem(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE));
|
||||
private final JMenuItem helpMenuItem = new JMenuItem(SparkRes.getImageIcon(SparkRes.SMALL_QUESTION));
|
||||
|
||||
private final JMenuBar mainWindowBar = new JMenuBar();
|
||||
|
||||
private boolean focused;
|
||||
|
||||
private JToolBar topBar = new JToolBar();
|
||||
|
||||
private static MainWindow singleton;
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of <CODE>MainWindow</CODE>,
|
||||
* creating it if necessary.
|
||||
* <p/>
|
||||
*
|
||||
* @return the singleton instance of <Code>MainWindow</CODE>
|
||||
*/
|
||||
public static MainWindow getInstance() {
|
||||
// Synchronize on LOCK to ensure that we don't end up creating
|
||||
// two singletons.
|
||||
synchronized (LOCK) {
|
||||
if (null == singleton) {
|
||||
MainWindow controller = new MainWindow(Default.getString(Default.APPLICATION_NAME), SparkRes.getImageIcon(SparkRes.MAIN_IMAGE));
|
||||
singleton = controller;
|
||||
return controller;
|
||||
}
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs the UI for the MainWindow. The MainWindow UI is the container for the
|
||||
* entire Spark application.
|
||||
*
|
||||
* @param title the title of the frame.
|
||||
* @param icon the icon used in the frame.
|
||||
*/
|
||||
private MainWindow(String title, ImageIcon icon) {
|
||||
// Initialize and dock the menus
|
||||
configureMenu();
|
||||
|
||||
// Add Workspace Container
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
|
||||
// Add menubar
|
||||
this.setJMenuBar(mainWindowBar);
|
||||
this.getContentPane().add(topBar, BorderLayout.NORTH);
|
||||
|
||||
setTitle(title + " - " + StringUtils.parseName(SparkManager.getConnection().getUser()));
|
||||
setIconImage(icon.getImage());
|
||||
|
||||
// Setup WindowListener to be the proxy to the actual window listener
|
||||
// which cannot normally be used outside of the Window component because
|
||||
// of protected access.
|
||||
addWindowListener(new WindowAdapter() {
|
||||
|
||||
/**
|
||||
* This event fires when the window has become active.
|
||||
*
|
||||
* @param e WindowEvent is not used.
|
||||
*/
|
||||
public void windowActivated(WindowEvent e) {
|
||||
fireWindowActivated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when a window is de-activated.
|
||||
*/
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event fires whenever a user minimizes the window
|
||||
* from the toolbar.
|
||||
*
|
||||
* @param e WindowEvent is not used.
|
||||
*/
|
||||
public void windowIconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This event fires when the application is closing.
|
||||
* This allows Plugins to do any persistence or other
|
||||
* work before exiting.
|
||||
*
|
||||
* @param e WindowEvent is never used.
|
||||
*/
|
||||
public void windowClosing(WindowEvent e) {
|
||||
setVisible(false);
|
||||
|
||||
// Show confirmation about hiding.
|
||||
// SparkManager.getNotificationsEngine().confirmHidingIfNecessary();
|
||||
}
|
||||
});
|
||||
|
||||
this.addWindowFocusListener(new Focuser());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a MainWindow listener to {@link MainWindow}. The
|
||||
* listener will be called when either the MainWindow has been minimized, maximized,
|
||||
* or is shutting down.
|
||||
*
|
||||
* @param listener the <code>MainWindowListener</code> to register
|
||||
*/
|
||||
public void addMainWindowListener(MainWindowListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link MainWindowListener}.
|
||||
*
|
||||
* @param listener the <code>MainWindowListener</code> to remove.
|
||||
*/
|
||||
public void removeMainWindowListener(MainWindowListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies all {@link MainWindowListener}s that the <code>MainWindow</code>
|
||||
* has been activated.
|
||||
*/
|
||||
private void fireWindowActivated() {
|
||||
final Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
((MainWindowListener)iter.next()).mainWindowActivated();
|
||||
}
|
||||
if (Spark.isMac()) {
|
||||
setJMenuBar(mainWindowBar);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies all {@link MainWindowListener}s that the <code>MainWindow</code>
|
||||
* is shutting down.
|
||||
*/
|
||||
private void fireWindowShutdown() {
|
||||
final Iterator iter = listeners.iterator();
|
||||
while (iter.hasNext()) {
|
||||
((MainWindowListener)iter.next()).shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the Preferences Dialog.
|
||||
*
|
||||
* @param e the ActionEvent
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource().equals(preferenceMenuItem)) {
|
||||
SparkManager.getPreferenceManager().showPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares Spark for shutting down by first calling all {@link MainWindowListener}s and
|
||||
* setting the Agent to be offline.
|
||||
*/
|
||||
public void shutdown() {
|
||||
// Notify all MainWindowListeners
|
||||
try {
|
||||
fireWindowShutdown();
|
||||
}
|
||||
finally {
|
||||
// Close application.
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares Spark for shutting down by first calling all {@link MainWindowListener}s and
|
||||
* setting the Agent to be offline.
|
||||
*/
|
||||
public void logout() {
|
||||
// Set auto-login to false;
|
||||
SettingsManager.getLocalPreferences().setAutoLogin(false);
|
||||
|
||||
// Notify all MainWindowListeners
|
||||
try {
|
||||
fireWindowShutdown();
|
||||
|
||||
final XMPPConnection con = SparkManager.getConnection();
|
||||
if (con.isConnected()) {
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
try {
|
||||
String command = "";
|
||||
if (Spark.isWindows()) {
|
||||
command = Spark.getBinDirectory().getParentFile().getCanonicalPath() + "\\Spark.exe";
|
||||
}
|
||||
else if (Spark.isMac()) {
|
||||
command = "open -a Spark";
|
||||
}
|
||||
|
||||
Runtime.getRuntime().exec(command);
|
||||
}
|
||||
catch (IOException e) {
|
||||
Log.error("Error starting Spark", e);
|
||||
}
|
||||
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the Main Toolbar with File, Tools and Help.
|
||||
*/
|
||||
private void configureMenu() {
|
||||
// setup file menu
|
||||
JMenuItem exitMenuItem = new JMenuItem("Exit");
|
||||
|
||||
// Setup ResourceUtils
|
||||
ResourceUtils.resButton(connectMenu, "&" + Default.getString(Default.APPLICATION_NAME));
|
||||
ResourceUtils.resButton(contactsMenu, "Con&tacts");
|
||||
ResourceUtils.resButton(actionsMenu, "&Actions");
|
||||
ResourceUtils.resButton(exitMenuItem, "&Exit");
|
||||
ResourceUtils.resButton(pluginsMenu, "&Plugins");
|
||||
|
||||
exitMenuItem.setIcon(null);
|
||||
|
||||
mainWindowBar.add(connectMenu);
|
||||
mainWindowBar.add(contactsMenu);
|
||||
mainWindowBar.add(actionsMenu);
|
||||
//mainWindowBar.add(pluginsMenu);
|
||||
mainWindowBar.add(helpMenu);
|
||||
|
||||
|
||||
preferenceMenuItem = new JMenuItem(SparkRes.getImageIcon(SparkRes.PREFERENCES_IMAGE));
|
||||
preferenceMenuItem.setText("Spark Preferences");
|
||||
preferenceMenuItem.addActionListener(this);
|
||||
connectMenu.add(preferenceMenuItem);
|
||||
connectMenu.addSeparator();
|
||||
|
||||
JMenuItem logoutMenuItem = new JMenuItem("Log Out");
|
||||
ResourceUtils.resButton(logoutMenuItem, "L&og Out");
|
||||
logoutMenuItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
logout();
|
||||
}
|
||||
});
|
||||
|
||||
if (Spark.isWindows()) {
|
||||
connectMenu.add(logoutMenuItem);
|
||||
}
|
||||
|
||||
connectMenu.addSeparator();
|
||||
|
||||
connectMenu.add(exitMenuItem);
|
||||
|
||||
Action showTrafficAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
EnhancedDebuggerWindow window = EnhancedDebuggerWindow.getInstance();
|
||||
window.setVisible(true);
|
||||
}
|
||||
};
|
||||
showTrafficAction.putValue(Action.NAME, "Show Traffic Window");
|
||||
showTrafficAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.TRAFFIC_LIGHT_IMAGE));
|
||||
|
||||
Action updateAction = new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
checkUpdate(true);
|
||||
}
|
||||
};
|
||||
|
||||
updateAction.putValue(Action.NAME, "Check For Updates");
|
||||
updateAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16));
|
||||
|
||||
// Build Help Menu
|
||||
helpMenu.setText("Help");
|
||||
//s helpMenu.add(helpMenuItem);
|
||||
helpMenu.add(showTrafficAction);
|
||||
helpMenu.add(updateAction);
|
||||
helpMenu.addSeparator();
|
||||
helpMenu.add(menuAbout);
|
||||
|
||||
// ResourceUtils - Adds mnemonics
|
||||
ResourceUtils.resButton(preferenceMenuItem, "&Preferences");
|
||||
ResourceUtils.resButton(helpMenu, "&Help");
|
||||
ResourceUtils.resButton(menuAbout, "&About");
|
||||
ResourceUtils.resButton(helpMenuItem, "&Online Help");
|
||||
|
||||
// Register shutdown with the exit menu.
|
||||
exitMenuItem.addActionListener(new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
shutdown();
|
||||
}
|
||||
});
|
||||
|
||||
helpMenuItem.addActionListener(new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
BrowserLauncher.openURL("http://www.jivesoftware.org/community/kbcategory.jspa?categoryID=23");
|
||||
}
|
||||
catch (IOException browserException) {
|
||||
Log.error("Error launching browser:", browserException);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Show About Box
|
||||
menuAbout.addActionListener(new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showAboutBox();
|
||||
}
|
||||
});
|
||||
|
||||
int numberOfMillisecondsInTheFuture = 15000; // 15 sec
|
||||
Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture);
|
||||
Timer timer = new Timer();
|
||||
|
||||
timer.schedule(new TimerTask() {
|
||||
public void run() {
|
||||
checkUpdate(false);
|
||||
}
|
||||
}, timeToRun);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the JMenuBar for the MainWindow. You would call this if you
|
||||
* wished to add or remove menu items to the main menubar. (File | Tools | Help)
|
||||
*
|
||||
* @return the Jive Talker Main Window MenuBar
|
||||
*/
|
||||
public JMenuBar getMenu() {
|
||||
return mainWindowBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Menu in the JMenuBar by it's name. For example:<p>
|
||||
* <pre>
|
||||
* JMenu toolsMenu = getMenuByName("Tools");
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* @param name the name of the Menu.
|
||||
* @return the JMenu item with the requested name.
|
||||
*/
|
||||
public JMenu getMenuByName(String name) {
|
||||
for (int i = 0; i < getMenu().getMenuCount(); i++) {
|
||||
JMenu menu = getMenu().getMenu(i);
|
||||
if (menu.getText().equals(name)) {
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Spark window is in focus.
|
||||
*
|
||||
* @return true if the Spark window is in focus.
|
||||
*/
|
||||
public boolean isInFocus() {
|
||||
return focused;
|
||||
}
|
||||
|
||||
private class Focuser implements WindowFocusListener {
|
||||
long timer;
|
||||
|
||||
public void windowGainedFocus(WindowEvent e) {
|
||||
focused = true;
|
||||
}
|
||||
|
||||
public void windowLostFocus(WindowEvent e) {
|
||||
focused = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the top toolbar in the Main Window to allow for customization.
|
||||
*
|
||||
* @return the MainWindows top toolbar.
|
||||
*/
|
||||
public JToolBar getTopToolBar() {
|
||||
return topBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for the latest update on the server.
|
||||
*
|
||||
* @param forced true if you want to bypass the normal checking security.
|
||||
*/
|
||||
private void checkUpdate(final boolean forced) {
|
||||
final CheckUpdates updater = new CheckUpdates();
|
||||
try {
|
||||
SwingWorker stopWorker = new SwingWorker() {
|
||||
public Object construct() {
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public void finished() {
|
||||
try {
|
||||
updater.checkForUpdate(forced);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("There was an error while checking for a new update.", e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
stopWorker.start();
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.warning("Error updating.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the About Box for Spark.
|
||||
*/
|
||||
public void showAboutBox() {
|
||||
JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion(),
|
||||
"About", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
||||
52
src/java/org/jivesoftware/MainWindowListener.java
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
/**
|
||||
* The <code>MainWindowListener</code> interface is one of the interfaces extension
|
||||
* writers use to add functionality to Spark.
|
||||
* <p/>
|
||||
* In general, you implement this interface in order to listen
|
||||
* for Window events that could otherwise not be listened to by attaching
|
||||
* to the MainWindow due to security restrictions.
|
||||
*/
|
||||
public interface MainWindowListener {
|
||||
|
||||
/**
|
||||
* Invoked by the <code>MainWindow</code> when it is about the shutdown.
|
||||
* When invoked, the <code>MainWindowListener</code>
|
||||
* should do anything necessary to persist their current state.
|
||||
* <code>MainWindowListeners</code> authors should take care to ensure
|
||||
* that any extraneous processing is not performed on this method, as it would
|
||||
* cause a delay in the shutdown process.
|
||||
*
|
||||
* @see org.jivesoftware.MainWindow
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Invoked by the <code>MainWindow</code> when it has been activated, such
|
||||
* as when it is coming out of a minimized state.
|
||||
* When invoked, the <code>MainWindowListener</code>
|
||||
* should do anything necessary to smoothly transition back to the application.
|
||||
*
|
||||
* @see org.jivesoftware.MainWindow
|
||||
*/
|
||||
void mainWindowActivated();
|
||||
|
||||
/**
|
||||
* Invoked by the <code>MainWindow</code> when it has been minimized in the toolbar.
|
||||
*
|
||||
* @see org.jivesoftware.MainWindow
|
||||
*/
|
||||
void mainWindowDeactivated();
|
||||
|
||||
}
|
||||
324
src/java/org/jivesoftware/Spark.java
Normal file
@ -0,0 +1,324 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Insets;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* In many cases, you will need to know the structure of the Spark installation, such as the directory structures, what
|
||||
* type of system Spark is running on, and also the arguments which were passed into Spark on startup. The <code>Spark</code>
|
||||
* class provides some simple static calls to retrieve this information.
|
||||
*
|
||||
* @version 1.0, 11/17/2005
|
||||
*/
|
||||
public final class Spark {
|
||||
|
||||
private static final String USER_HOME = System.getProperties().getProperty("user.home");
|
||||
private static String argument;
|
||||
|
||||
private static File RESOURCE_DIRECTORY;
|
||||
private static File BIN_DIRECTORY;
|
||||
private static File LOG_DIRECTORY;
|
||||
|
||||
|
||||
/**
|
||||
* Private constructor that invokes the LoginDialog and
|
||||
* the Spark Main Application.
|
||||
*/
|
||||
private Spark() {
|
||||
final LoginDialog dialog = new LoginDialog();
|
||||
dialog.invoke(new JFrame());
|
||||
}
|
||||
|
||||
/**
|
||||
* Invocation method.
|
||||
*
|
||||
* @param args - Will receive arguments from Java Web Start.
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true;
|
||||
EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10;
|
||||
XMPPConnection.DEBUG_ENABLED = true;
|
||||
|
||||
|
||||
String current = System.getProperty("java.library.path");
|
||||
String classPath = System.getProperty("java.class.path");
|
||||
|
||||
// Set UIManager properties for JTree
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
|
||||
/** Update Library Path **/
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(current);
|
||||
buf.append(";");
|
||||
|
||||
|
||||
final String workingDirectory = System.getProperty("appdir");
|
||||
if (workingDirectory == null) {
|
||||
RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile();
|
||||
BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile();
|
||||
LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile();
|
||||
RESOURCE_DIRECTORY.mkdirs();
|
||||
LOG_DIRECTORY.mkdirs();
|
||||
if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) {
|
||||
JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This is the installed executable.
|
||||
File workingDir = new File(workingDirectory);
|
||||
|
||||
RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile();
|
||||
BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile();
|
||||
LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile();
|
||||
LOG_DIRECTORY.mkdirs();
|
||||
buf.append(RESOURCE_DIRECTORY.getAbsolutePath()).append(";");
|
||||
}
|
||||
|
||||
|
||||
buf.append(classPath);
|
||||
|
||||
// Update System Properties
|
||||
System.setProperty("java.library.path", buf.toString());
|
||||
|
||||
|
||||
System.setProperty("sun.java2d.noddraw", "true");
|
||||
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
// Start Application
|
||||
new Spark();
|
||||
}
|
||||
});
|
||||
|
||||
// Handle arguments
|
||||
if (args.length > 0) {
|
||||
argument = args[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Setup the look and feel of this application.
|
||||
static {
|
||||
try {
|
||||
String classname = UIManager.getSystemLookAndFeelClassName();
|
||||
|
||||
if (classname.indexOf("Windows") != -1) {
|
||||
try {
|
||||
try {
|
||||
|
||||
UIManager.setLookAndFeel(new com.jgoodies.looks.windows.WindowsLookAndFeel());
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
//Handling Exception
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
else if (classname.indexOf("mac") != -1 || classname.indexOf("apple") != -1) {
|
||||
UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
|
||||
|
||||
}
|
||||
else {
|
||||
UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
|
||||
UIManager.put("Tree.openIcon", SparkRes.getImageIcon(SparkRes.FOLDER));
|
||||
UIManager.put("Tree.closedIcon", SparkRes.getImageIcon(SparkRes.FOLDER_CLOSED));
|
||||
UIManager.put("Button.showMnemonics", Boolean.TRUE);
|
||||
UIManager.put("CollapsiblePane.titleFont", new Font("Dialog", Font.BOLD, 11));
|
||||
UIManager.put("DockableFrameTitlePane.font", new Font("Verdana", Font.BOLD, 10));
|
||||
UIManager.put("DockableFrame.inactiveTitleForeground", Color.white);
|
||||
UIManager.put("DockableFrame.inactiveTitleBackground", new Color(180, 176, 160));
|
||||
UIManager.put("DockableFrame.activeTitleBackground", new Color(105, 132, 188));
|
||||
UIManager.put("DockableFrame.activeTitleForeground", Color.white);
|
||||
UIManager.put("CollapsiblePane.background", Color.white);
|
||||
UIManager.put("TextField.font", new Font("Dialog", Font.PLAIN, 11));
|
||||
if (isWindows()) {
|
||||
UIManager.put("DockableFrameTitlePane.titleBarComponent", Boolean.valueOf(true));
|
||||
}
|
||||
else {
|
||||
UIManager.put("DockableFrameTitlePane.titleBarComponent", Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
UIManager.put("SidePane.lineColor", Color.BLACK);
|
||||
UIManager.put("SidePane.foreground", Color.BLACK);
|
||||
|
||||
|
||||
Color menuBarColor = new Color(255, 255, 255);//235, 233, 237);
|
||||
UIManager.put("MenuBar.background", menuBarColor);
|
||||
UIManager.put("JideTabbedPane.tabInsets", new Insets(3, 10, 3, 10));
|
||||
UIManager.put("JideTabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
|
||||
|
||||
installBaseUIProperties();
|
||||
|
||||
//com.install4j.api.launcher.StartupNotification.registerStartupListener(new SparkStartupListener());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if we are running on windows.
|
||||
*
|
||||
* @return true if we are running on windows, false otherwise.
|
||||
*/
|
||||
public static boolean isWindows() {
|
||||
final String osName = System.getProperty("os.name").toLowerCase();
|
||||
return osName.startsWith("windows");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if we are running on a mac.
|
||||
*
|
||||
* @return true if we are running on a mac, false otherwise.
|
||||
*/
|
||||
public static boolean isMac() {
|
||||
String lcOSName = System.getProperty("os.name").toLowerCase();
|
||||
return lcOSName.indexOf("mac") != -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value associated with a passed in argument. Spark
|
||||
* accepts HTTP style attributes to allow for name-value pairing.
|
||||
* ex. username=foo&password=pwd.
|
||||
* To retrieve the value of username, you would do the following:
|
||||
* <pre>
|
||||
* String value = Spark.getArgumentValue("username");
|
||||
* </pre>
|
||||
*
|
||||
* @param argumentName the name of the argument to retrieve.
|
||||
* @return the value of the argument. If no argument was found, null
|
||||
* will be returned.
|
||||
*/
|
||||
public static String getArgumentValue(String argumentName) {
|
||||
if (argument == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String arg = argumentName + "=";
|
||||
|
||||
int index = argument.indexOf(arg);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String value = argument.substring(index + arg.length());
|
||||
int index2 = value.indexOf("&");
|
||||
if (index2 != -1) {
|
||||
// Must be the last argument
|
||||
value = value.substring(0, index2);
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bin directory of the Spark install. The bin directory contains the startup scripts needed
|
||||
* to start Spark.
|
||||
*
|
||||
* @return the bin directory.
|
||||
*/
|
||||
public static File getBinDirectory() {
|
||||
return BIN_DIRECTORY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resource directory of the Spark install. The resource directory contains all native
|
||||
* libraries needed to run os specific operations, such as tray support. You may place other native
|
||||
* libraries within this directory if you wish to have them placed into the system.library.path.
|
||||
*
|
||||
* @return the resource directory.
|
||||
*/
|
||||
public static File getResourceDirectory() {
|
||||
return RESOURCE_DIRECTORY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the log directory. The log directory contains all debugging and error files for Spark.
|
||||
*
|
||||
* @return the log directory.
|
||||
*/
|
||||
public static File getLogDirectory() {
|
||||
return LOG_DIRECTORY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the User specific directory for this Spark instance. The user home is where all user specific
|
||||
* files are placed to run Spark within a multi-user system.
|
||||
*
|
||||
* @return the user home;
|
||||
*/
|
||||
public static String getUserHome() {
|
||||
return USER_HOME;
|
||||
}
|
||||
|
||||
public static boolean isCustomBuild() {
|
||||
return "true".equals(Default.getString("CUSTOM"));
|
||||
}
|
||||
|
||||
public static void installBaseUIProperties() {
|
||||
UIManager.put("TextField.lightforeground", Color.BLACK);
|
||||
UIManager.put("TextField.foreground", Color.BLACK);
|
||||
UIManager.put("TextField.caretForeground", Color.black);
|
||||
|
||||
UIManager.put("List.selectionBackground", new Color(217, 232, 250));
|
||||
UIManager.put("List.selectionForeground", Color.black);
|
||||
UIManager.put("List.selectionBorder", new Color(187, 195, 215));
|
||||
UIManager.put("List.foreground", Color.black);
|
||||
UIManager.put("List.background", Color.white);
|
||||
UIManager.put("TextPane.foreground", Color.black);
|
||||
UIManager.put("TextPane.background", Color.white);
|
||||
UIManager.put("TextPane.inactiveForeground", Color.white);
|
||||
UIManager.put("TextPane.caretForeground", Color.black);
|
||||
UIManager.put("ChatInput.SelectedTextColor", Color.white);
|
||||
UIManager.put("ChatInput.SelectionColor", new Color(209, 223, 242));
|
||||
UIManager.put("ContactItemNickname.foreground", Color.black);
|
||||
UIManager.put("ContactItemDescription.foreground", Color.lightGray);
|
||||
UIManager.put("ContactItem.background", Color.white);
|
||||
UIManager.put("ContactItem.border", BorderFactory.createLineBorder(Color.white));
|
||||
UIManager.put("ContactItemOffline.color", Color.gray);
|
||||
UIManager.put("Table.foreground", Color.black);
|
||||
UIManager.put("Table.background", Color.white);
|
||||
|
||||
// Chat Area Text Settings
|
||||
UIManager.put("Link.foreground", Color.blue);
|
||||
UIManager.put("User.foreground", Color.blue);
|
||||
UIManager.put("OtherUser.foreground", Color.red);
|
||||
UIManager.put("Notification.foreground", new Color(51, 153, 51));
|
||||
UIManager.put("Error.foreground", Color.red);
|
||||
UIManager.put("Question.foreground", Color.red);
|
||||
}
|
||||
}
|
||||
103
src/java/org/jivesoftware/SparkStartupListener.java
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.spark.ChatManager;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.UserManager;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.conferences.ConferenceUtils;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
/**
|
||||
* Uses the Windows registry to perform URI XMPP mappings.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class SparkStartupListener implements com.install4j.api.launcher.StartupNotification.Listener {
|
||||
|
||||
public void startupPerformed(String string) {
|
||||
if (string.indexOf("xmpp") == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.indexOf("?message") != -1) {
|
||||
try {
|
||||
handleJID(string);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
else if (string.indexOf("?join") != -1) {
|
||||
try {
|
||||
handleConference(string);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to handle different types of URI Mappings.
|
||||
*
|
||||
* @param uriMapping the uri mapping string.
|
||||
* @throws Exception thrown if an exception occurs.
|
||||
*/
|
||||
public void handleJID(String uriMapping) throws Exception {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int messageIndex = uriMapping.indexOf("?message");
|
||||
|
||||
int bodyIndex = uriMapping.indexOf("body=");
|
||||
|
||||
String jid = uriMapping.substring(index + 5, messageIndex);
|
||||
String body = null;
|
||||
|
||||
// Find body
|
||||
if (bodyIndex != -1) {
|
||||
body = uriMapping.substring(bodyIndex + 5);
|
||||
}
|
||||
|
||||
UserManager userManager = SparkManager.getUserManager();
|
||||
String nickname = userManager.getUserNicknameFromJID(jid);
|
||||
if (nickname == null) {
|
||||
nickname = jid;
|
||||
}
|
||||
|
||||
ChatManager chatManager = SparkManager.getChatManager();
|
||||
ChatRoom chatRoom = chatManager.createChatRoom(jid, nickname, nickname);
|
||||
if (body != null) {
|
||||
Message message = new Message();
|
||||
message.setBody(body);
|
||||
chatRoom.insertMessage(message);
|
||||
chatRoom.sendMessage(message);
|
||||
}
|
||||
|
||||
chatManager.getChatContainer().activateChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the URI Mapping to join a conference room.
|
||||
*
|
||||
* @param uriMapping the uri mapping.
|
||||
* @throws Exception thrown if the conference cannot be joined.
|
||||
*/
|
||||
public void handleConference(String uriMapping) throws Exception {
|
||||
int index = uriMapping.indexOf("xmpp:");
|
||||
int join = uriMapping.indexOf("?join");
|
||||
|
||||
String conference = uriMapping.substring(index + 5, join);
|
||||
ConferenceUtils.autoJoinConferenceRoom(conference, conference, null);
|
||||
}
|
||||
}
|
||||
38
src/java/org/jivesoftware/Uninstaller.java
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware;
|
||||
|
||||
import com.install4j.api.Context;
|
||||
import com.install4j.api.ProgressInterface;
|
||||
import com.install4j.api.UninstallAction;
|
||||
import com.install4j.api.windows.WinRegistry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Performs registry operations on removal of the Spark client. This is a windows only function.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class Uninstaller extends UninstallAction {
|
||||
|
||||
public int getPercentOfTotalInstallation() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean performAction(Context context, ProgressInterface progressInterface) {
|
||||
return super.performAction(context, progressInterface); //To change body of overridden methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
public void removeStartup(File dir) {
|
||||
WinRegistry.deleteValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
|
||||
}
|
||||
}
|
||||
48
src/java/org/jivesoftware/resource/ConfigurationRes.java
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.resource;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class ConfigurationRes {
|
||||
private static PropertyResourceBundle prb;
|
||||
public static final String GLOBAL_ELEMENT_NAME = "GLOBAL_ELEMENT_NAME";
|
||||
public static final String DELETE_IMAGE = "DELETE_IMAGE";
|
||||
public static final String PERSONAL_NAMESPACE = "PERSONAL_NAMESPACE";
|
||||
public static final String HEADER_FILE = "HEADER_FILE";
|
||||
public static final String CHECK_IMAGE = "CHECK_IMAGE";
|
||||
|
||||
public static final String SPELLING_PROPERTIES = "SPELLING_PROPERTIES";
|
||||
public static final String PERSONAL_ELEMENT_NAME = "PERSONAL_ELEMENT_NAME";
|
||||
static ClassLoader cl = ConfigurationRes.class.getClassLoader();
|
||||
|
||||
static {
|
||||
prb = (PropertyResourceBundle)ResourceBundle.getBundle("org/jivesoftware/resource/configuration");
|
||||
}
|
||||
|
||||
public static final String getString(String propertyName) {
|
||||
return prb.getString(propertyName);
|
||||
}
|
||||
|
||||
public static final ImageIcon getImageIcon(String imageName) {
|
||||
final String iconURI = getString(imageName);
|
||||
final URL imageURL = cl.getResource(iconURI);
|
||||
return new ImageIcon(imageURL);
|
||||
}
|
||||
|
||||
public static final URL getURL(String propertyName) {
|
||||
return cl.getResource(getString(propertyName));
|
||||
}
|
||||
}
|
||||
102
src/java/org/jivesoftware/resource/Default.java
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.resource;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Default {
|
||||
private static PropertyResourceBundle prb;
|
||||
|
||||
private static Map customMap = new HashMap();
|
||||
|
||||
private static Map cache = new HashMap();
|
||||
|
||||
public static final String MAIN_IMAGE = "MAIN_IMAGE";
|
||||
public static final String APPLICATION_NAME = "APPLICATION_NAME";
|
||||
public static final String SHORT_NAME = "SHORT_NAME";
|
||||
public static final String LOGIN_DIALOG_BACKGROUND_IMAGE = "LOGIN_DIALOG_BACKGROUND_IMAGE";
|
||||
public static final String HOST_NAME = "HOST_NAME";
|
||||
public static final String SHOW_POWERED_BY = "SHOW_POWERED_BY";
|
||||
public static final String TOP_BOTTOM_BACKGROUND_IMAGE = "TOP_BOTTOM_BACKGROUND_IMAGE";
|
||||
public static final String BRANDED_IMAGE = "BRANDED_IMAGE";
|
||||
public static final String CUSTOM = "CUSTOM";
|
||||
public static final String SECONDARY_BACKGROUND_IMAGE = "SECONDARY_BACKGROUND_IMAGE";
|
||||
public static final String HOVER_TEXT_COLOR = "HOVER_TEXT_COLOR";
|
||||
public static final String TEXT_COLOR = "TEXT_COLOR";
|
||||
public static final String TAB_START_COLOR = "TAB_START_COLOR";
|
||||
public static final String TAB_END_COLOR = "TAB_END_COLOR";
|
||||
public static final String CONTACT_GROUP_START_COLOR = "CONTACT_GROUP_START_COLOR";
|
||||
public static final String CONTACT_GROUP_END_COLOR = "CONTACT_GROUP_END_COLOR";
|
||||
public static final String PROXY_HOST = "PROXY_HOST";
|
||||
public static final String PROXY_PORT = "PROXY_PORT";
|
||||
public static final String ACCOUNT_DISABLED = "ACCOUNT_DISABLED";
|
||||
|
||||
static ClassLoader cl = SparkRes.class.getClassLoader();
|
||||
|
||||
static {
|
||||
prb = (PropertyResourceBundle)ResourceBundle.getBundle("org/jivesoftware/resource/default");
|
||||
}
|
||||
|
||||
public static void putCustomValue(String value, Object object) {
|
||||
customMap.put(value, object);
|
||||
}
|
||||
|
||||
public static void removeCustomValue(String value) {
|
||||
customMap.remove(value);
|
||||
}
|
||||
|
||||
public static void clearCustomValues() {
|
||||
customMap.clear();
|
||||
}
|
||||
|
||||
public static final String getString(String propertyName) {
|
||||
return prb.getString(propertyName);
|
||||
}
|
||||
|
||||
public static final ImageIcon getImageIcon(String imageName) {
|
||||
// Check custom map
|
||||
Object o = customMap.get(imageName);
|
||||
if (o != null && o instanceof ImageIcon) {
|
||||
return (ImageIcon)o;
|
||||
}
|
||||
|
||||
// Otherwise check cache
|
||||
o = cache.get(imageName);
|
||||
if (o != null && o instanceof ImageIcon) {
|
||||
return (ImageIcon)o;
|
||||
}
|
||||
|
||||
// Otherwise, load and add to cache.
|
||||
try {
|
||||
final String iconURI = getString(imageName);
|
||||
final URL imageURL = cl.getResource(iconURI);
|
||||
|
||||
final ImageIcon icon = new ImageIcon(imageURL);
|
||||
cache.put(imageName, icon);
|
||||
return icon;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println(imageName + " not found.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final URL getURL(String propertyName) {
|
||||
return cl.getResource(getString(propertyName));
|
||||
}
|
||||
|
||||
}
|
||||
79
src/java/org/jivesoftware/resource/EmotionRes.java
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.resource;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EmotionRes {
|
||||
private static final Map emotionMap = new LinkedHashMap();
|
||||
static ClassLoader cl = EmotionRes.class.getClassLoader();
|
||||
|
||||
static {
|
||||
emotionMap.put(":)", "images/emoticons/happy.gif");
|
||||
emotionMap.put(":-)", "images/emoticons/happy.gif");
|
||||
emotionMap.put(":(", "images/emoticons/sad.gif");
|
||||
emotionMap.put(":D", "images/emoticons/grin.gif");
|
||||
emotionMap.put(":x", "images/emoticons/love.gif");
|
||||
emotionMap.put(";\\", "images/emoticons/mischief.gif");
|
||||
emotionMap.put("B-)", "images/emoticons/cool.gif");
|
||||
emotionMap.put("]:)", "images/emoticons/devil.gif");
|
||||
emotionMap.put(":p", "images/emoticons/silly.gif");
|
||||
emotionMap.put("X-(", "images/emoticons/angry.gif");
|
||||
emotionMap.put(":^0", "images/emoticons/laugh.gif");
|
||||
emotionMap.put(";)", "images/emoticons/wink.gif");
|
||||
emotionMap.put(";-)", "images/emoticons/wink.gif");
|
||||
emotionMap.put(":8}", "images/emoticons/blush.gif");
|
||||
emotionMap.put(":_|", "images/emoticons/cry.gif");
|
||||
emotionMap.put("?:|", "images/emoticons/confused.gif");
|
||||
emotionMap.put(":0", "images/emoticons/shocked.gif");
|
||||
emotionMap.put(":|", "images/emoticons/plain.gif");
|
||||
emotionMap.put("8-)", "images/emoticons/eyeRoll.gif");
|
||||
emotionMap.put("|-)", "images/emoticons/sleepy.gif");
|
||||
emotionMap.put("<:o)", "images/emoticons/party.gif");
|
||||
}
|
||||
|
||||
public static final ImageIcon getImageIcon(String face) {
|
||||
final String value = (String)emotionMap.get(face);
|
||||
if (value != null) {
|
||||
final URL url = cl.getResource(value);
|
||||
if (url != null) {
|
||||
return new ImageIcon(url);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final URL getURL(String face) {
|
||||
final String value = (String)emotionMap.get(face);
|
||||
if (value != null) {
|
||||
final URL url = cl.getResource(value);
|
||||
if (url != null) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Map getEmoticonMap() {
|
||||
Map newMap = new HashMap(emotionMap);
|
||||
newMap.remove("8-)");
|
||||
newMap.remove("|-)");
|
||||
newMap.remove("<:o)");
|
||||
newMap.remove(":-)");
|
||||
return newMap;
|
||||
}
|
||||
|
||||
}
|
||||
46
src/java/org/jivesoftware/resource/SoundsRes.java
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.resource;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class SoundsRes {
|
||||
private static PropertyResourceBundle prb;
|
||||
public static final String INCOMING_USER = "INCOMING_USER";
|
||||
public static final String TRAY_SHOWING = "TRAY_SHOWING";
|
||||
public static final String OPENING = "OPENING";
|
||||
public static final String CLOSING = "CLOSING";
|
||||
|
||||
|
||||
static ClassLoader cl = SoundsRes.class.getClassLoader();
|
||||
|
||||
static {
|
||||
prb = (PropertyResourceBundle)ResourceBundle.getBundle("org/jivesoftware/resource/sounds");
|
||||
}
|
||||
|
||||
public static final String getString(String propertyName) {
|
||||
return prb.getString(propertyName);
|
||||
}
|
||||
|
||||
public static final ImageIcon getImageIcon(String imageName) {
|
||||
final String iconURI = getString(imageName);
|
||||
final URL imageURL = cl.getResource(iconURI);
|
||||
return new ImageIcon(imageURL);
|
||||
}
|
||||
|
||||
public static final URL getURL(String propertyName) {
|
||||
return cl.getResource(getString(propertyName));
|
||||
}
|
||||
}
|
||||
318
src/java/org/jivesoftware/resource/SparkRes.java
Normal file
@ -0,0 +1,318 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.resource;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class SparkRes {
|
||||
private static PropertyResourceBundle prb;
|
||||
|
||||
public static final String NOTE_EDIT_16x16 = "NOTE_EDIT_16x16";
|
||||
public static final String MAGICIAN_IMAGE = "MAGICIAN_IMAGE";
|
||||
public static final String IM_AWAY = "IM_AWAY";
|
||||
public static final String RED_FLAG_16x16 = "RED_FLAG_16x16";
|
||||
public static final String LOGIN_DIALOG_USERNAME = "LOGIN_DIALOG_USERNAME";
|
||||
public static final String PREFERENCES_IMAGE = "PREFERENCES_IMAGE";
|
||||
public static final String CURRENT_AGENTS = "CURRENT_AGENTS";
|
||||
public static final String LOGIN_DIALOG_QUIT = "LOGIN_DIALOG_QUIT";
|
||||
public static final String RIGHT_ARROW_IMAGE = "RIGHT_ARROW_IMAGE";
|
||||
public static final String MEGAPHONE_16x16 = "MEGAPHONE_16x16";
|
||||
public static final String SMALL_DOCUMENT_ADD = "SMALL_DOCUMENT_ADD";
|
||||
public static final String ADD_TO_KB = "ADD_TO_KB";
|
||||
public static final String DATA_REFRESH_16x16 = "DATA_REFRESH_16x16";
|
||||
public static final String TEXT_ITALIC = "TEXT_ITALIC";
|
||||
public static final String NOTEBOOK_IMAGE = "NOTEBOOK_IMAGE";
|
||||
public static final String AVAILABLE_USER = "AVAILABLE_USER";
|
||||
public static final String SPARK_IMAGE = "SPARK_IMAGE";
|
||||
public static final String VIEW = "VIEW";
|
||||
public static final String TEXT_BOLD = "TEXT_BOLD";
|
||||
public static final String SMALL_USER1_MESSAGE = "SMALL_USER1_MESSAGE";
|
||||
public static final String SERVER_UNAVAILABLE = "SERVER_UNAVAILABLE";
|
||||
public static final String CONFERENCE_IMAGE_16x16 = "CONFERENCE_IMAGE_16x16";
|
||||
public static final String WORKGROUP_QUEUE = "WORKGROUP_QUEUE";
|
||||
public static final String SEARCH_IMAGE_32x32 = "SEARCH_IMAGE_32x32";
|
||||
public static final String ADD_BOOKMARK_ICON = "ADD_BOOKMARK_ICON";
|
||||
public static final String TEXT_UNDERLINE = "TEXT_UNDERLINE";
|
||||
public static final String TOOLBOX = "TOOLBOX";
|
||||
public static final String PROFILE_ICON = "PROFILE_ICON";
|
||||
public static final String SMALL_CURRENT_AGENTS = "SMALL_CURRENT_AGENTS";
|
||||
public static final String STAR_GREEN_IMAGE = "STAR_GREEN_IMAGE";
|
||||
public static final String QUESTIONS_ANSWERS = "QUESTIONS_ANSWERS";
|
||||
public static final String DOCUMENT_EXCHANGE_IMAGE = "DOCUMENT_EXCHANGE_IMAGE";
|
||||
public static final String MOBILE_PHONE_IMAGE = "MOBILE_PHONE_IMAGE";
|
||||
public static final String BLANK_IMAGE = "BLANK_IMAGE";
|
||||
public static final String LOCK_UNLOCK_16x16 = "LOCK_UNLOCK_16x16";
|
||||
public static final String BOOKMARK_ICON = "BOOKMARK_ICON";
|
||||
public static final String INFORMATION_ICO = "INFORMATION_ICO";
|
||||
public static final String VERSION = "VERSION";
|
||||
public static final String MAIL_INTO_16x16 = "MAIL_INTO_16x16";
|
||||
public static final String ERROR_INVALID_WORKGROUP = "ERROR_INVALID_WORKGROUP";
|
||||
public static final String SMALL_USER1_NEW = "SMALL_USER1_NEW";
|
||||
public static final String SMALL_USER_DELETE = "SMALL_USER_DELETE";
|
||||
public static final String CHATTING_AGENT_IMAGE = "CHATTING_AGENT_IMAGE";
|
||||
public static final String FORUM_TAB_TITLE = "FORUM_TAB_TITLE";
|
||||
public static final String DOCUMENT_16x16 = "DOCUMENT_16x16";
|
||||
public static final String KNOWLEDGE_BASE_TAB_TITLE = "KNOWLEDGE_BASE_TAB_TITLE";
|
||||
public static final String STAR_RED_IMAGE = "STAR_RED_IMAGE";
|
||||
public static final String USER1_BACK_16x16 = "USER1_BACK_16x16";
|
||||
public static final String SMALL_USER1_STOPWATCH = "SMALL_USER1_STOPWATCH";
|
||||
public static final String ADD_IMAGE_24x24 = "ADD_IMAGE_24x24";
|
||||
public static final String TRAFFIC_LIGHT_IMAGE = "TRAFFIC_LIGHT_IMAGE";
|
||||
public static final String GO = "GO";
|
||||
public static final String SMALL_USER1_INFORMATION = "SMALL_USER1_INFORMATION";
|
||||
public static final String DATA_DELETE_16x16 = "DATA_DELETE_16x16";
|
||||
public static final String SMALL_MESSAGE_IMAGE = "SMALL_MESSAGE_IMAGE";
|
||||
public static final String LOCK_16x16 = "LOCK_16x16";
|
||||
public static final String STAR_GREY_IMAGE = "STAR_GREY_IMAGE";
|
||||
public static final String MODERATOR_IMAGE = "MODERATOR_IMAGE";
|
||||
public static final String JOIN_GROUPCHAT_IMAGE = "JOIN_GROUPCHAT_IMAGE";
|
||||
public static final String UNRECOVERABLE_ERROR = "UNRECOVERABLE_ERROR";
|
||||
public static final String DOCUMENT_INFO_32x32 = "DOCUMENT_INFO_32x32";
|
||||
public static final String CREATE_FAQ_TITLE = "CREATE_FAQ_TITLE";
|
||||
public static final String SMALL_USER1_TIME = "SMALL_USER1_TIME";
|
||||
public static final String SMALL_ALL_AGENTS_IMAGE = "SMALL_ALL_AGENTS_IMAGE";
|
||||
public static final String PAWN_GLASS_WHITE = "PAWN_GLASS_WHITE";
|
||||
public static final String CURRENT_CHATS = "CURRENT_CHATS";
|
||||
public static final String INVALID_USERNAME_PASSWORD = "INVALID_USERNAME_PASSWORD";
|
||||
public static final String SMALL_DATA_FIND_IMAGE = "SMALL_DATA_FIND_IMAGE";
|
||||
public static final String CLOSE_IMAGE = "CLOSE_IMAGE";
|
||||
public static final String TEXT_NORMAL = "TEXT_NORMAL";
|
||||
public static final String STAR_YELLOW_IMAGE = "STAR_YELLOW_IMAGE";
|
||||
public static final String APP_NAME = "APP_NAME";
|
||||
public static final String ADD_CONTACT_IMAGE = "ADD_CONTACT_IMAGE";
|
||||
public static final String SEND_MAIL_IMAGE_16x16 = "SEND_MAIL_IMAGE_16x16";
|
||||
public static final String FOLDER = "FOLDER";
|
||||
public static final String LEFT_ARROW_IMAGE = "LEFT_ARROW_IMAGE";
|
||||
public static final String WELCOME = "WELCOME";
|
||||
public static final String BLUE_BALL = "BLUE_BALL";
|
||||
public static final String MESSAGE_DND = "MESSAGE_DND";
|
||||
public static final String DOCUMENT_FIND_16x16 = "DOCUMENT_FIND_16x16";
|
||||
public static final String RED_BALL = "RED_BALL";
|
||||
public static final String BRICKWALL_IMAGE = "BRICKWALL_IMAGE";
|
||||
public static final String MESSAGE_AWAY = "MESSAGE_AWAY";
|
||||
public static final String IM_DND = "IM_DND";
|
||||
public static final String SMALL_DELETE = "SMALL_DELETE";
|
||||
public static final String LINK_16x16 = "LINK_16x16";
|
||||
public static final String CALL_ICON = "CALL_ICON";
|
||||
public static final String MAIN_IMAGE = "MAIN_IMAGE";
|
||||
public static final String SMALL_CIRCLE_DELETE = "SMALL_CIRCLE_DELETE";
|
||||
public static final String SMALL_MESSAGE_EDIT_IMAGE = "SMALL_MESSAGE_EDIT_IMAGE";
|
||||
public static final String AWAY_USER = "AWAY_USER";
|
||||
public static final String SAVE_AS_16x16 = "SAVE_AS_16x16";
|
||||
public static final String FIND_TEXT_IMAGE = "FIND_TEXT_IMAGE";
|
||||
public static final String SEARCH = "SEARCH";
|
||||
public static final String STAR_BLUE_IMAGE = "STAR_BLUE_IMAGE";
|
||||
public static final String OFFLINE_ICO = "OFFLINE_ICO";
|
||||
public static final String SMALL_USER1_MOBILEPHONE = "SMALL_USER1_MOBILEPHONE";
|
||||
public static final String LOGIN_DIALOG_LOGIN_TITLE = "LOGIN_DIALOG_LOGIN_TITLE";
|
||||
public static final String ERASER_IMAGE = "ERASER_IMAGE";
|
||||
public static final String PRINTER_IMAGE_16x16 = "PRINTER_IMAGE_16x16";
|
||||
public static final String DOWNLOAD_16x16 = "DOWNLOAD_16x16";
|
||||
public static final String EARTH_LOCK_16x16 = "EARTH_LOCK_16x16";
|
||||
public static final String LOGIN_DIALOG_AUTHENTICATING = "LOGIN_DIALOG_AUTHENTICATING";
|
||||
public static final String HELP2_24x24 = "HELP2_24x24";
|
||||
public static final String MAIN_TITLE = "MAIN_TITLE";
|
||||
public static final String PROFILE_TAB_TITLE = "PROFILE_TAB_TITLE";
|
||||
public static final String CHAT_WORKSPACE = "CHAT_WORKSPACE";
|
||||
public static final String GREEN_FLAG_16x16 = "GREEN_FLAG_16x16";
|
||||
public static final String MAIN_IMAGE_ICO = "MAIN_IMAGE_ICO";
|
||||
public static final String TOOLBAR_BACKGROUND = "TOOLBAR_BACKGROUND";
|
||||
public static final String VIEW_IMAGE = "VIEW_IMAGE";
|
||||
public static final String CHATTING_CUSTOMER_IMAGE = "CHATTING_CUSTOMER_IMAGE";
|
||||
public static final String SMALL_ALARM_CLOCK = "SMALL_ALARM_CLOCK";
|
||||
public static final String INFORMATION_IMAGE = "INFORMATION_IMAGE";
|
||||
public static final String ACCEPT_CHAT = "ACCEPT_CHAT";
|
||||
public static final String SMALL_PIN_BLUE = "SMALL_PIN_BLUE";
|
||||
public static final String FONT_16x16 = "FONT_16x16";
|
||||
public static final String PAWN_GLASS_RED = "PAWN_GLASS_RED";
|
||||
public static final String LOGIN_DIALOG_WORKSPACE = "LOGIN_DIALOG_WORKSPACE";
|
||||
public static final String PAWN_GLASS_YELLOW = "PAWN_GLASS_YELLOW";
|
||||
public static final String ID_CARD_48x48 = "ID_CARD_48x48";
|
||||
public static final String DOWN_ARROW_IMAGE = "DOWN_ARROW_IMAGE";
|
||||
public static final String LOGIN_DIALOG_LOGIN = "LOGIN_DIALOG_LOGIN";
|
||||
public static final String HISTORY_16x16 = "HISTORY_16x16";
|
||||
public static final String SMALL_DOCUMENT_VIEW = "SMALL_DOCUMENT_VIEW";
|
||||
public static final String SMALL_AGENT_IMAGE = "SMALL_AGENT_IMAGE";
|
||||
public static final String SMALL_ALL_CHATS_IMAGE = "SMALL_ALL_CHATS_IMAGE";
|
||||
public static final String SERVER_ICON = "SERVER_ICON";
|
||||
public static final String SMALL_USER_ENTER = "SMALL_USER_ENTER";
|
||||
public static final String SMALL_CLOSE_BUTTON = "SMALL_CLOSE_BUTTON";
|
||||
public static final String ON_PHONE_IMAGE = "ON_PHONE_IMAGE";
|
||||
public static final String MINUS_SIGN = "MINUS_SIGN";
|
||||
public static final String PAWN_GLASS_GREEN = "PAWN_GLASS_GREEN";
|
||||
public static final String COPY_16x16 = "COPY_16x16";
|
||||
public static final String SMALL_WORKGROUP_QUEUE_IMAGE = "SMALL_WORKGROUP_QUEUE_IMAGE";
|
||||
public static final String CHAT_QUEUE = "CHAT_QUEUE";
|
||||
public static final String SEND = "SEND";
|
||||
public static final String USER_HEADSET_24x24 = "USER_HEADSET_24x24";
|
||||
public static final String BUSY_IMAGE = "BUSY_IMAGE";
|
||||
public static final String FUNNEL_DOWN_16x16 = "FUNNEL_DOWN_16x16";
|
||||
public static final String PUSH_URL_16x16 = "PUSH_URL_16x16";
|
||||
public static final String EARTH_VIEW_16x16 = "EARTH_VIEW_16x16";
|
||||
public static final String SMALL_QUESTION = "SMALL_QUESTION";
|
||||
public static final String SEND_FILE_ICON = "SEND_FILE_ICON";
|
||||
public static final String LOGIN_KEY_IMAGE = "LOGIN_KEY_IMAGE";
|
||||
public static final String CREATE_FAQ_ENTRY = "CREATE_FAQ_ENTRY";
|
||||
public static final String SPELL_CHECK_IMAGE = "SPELL_CHECK_IMAGE";
|
||||
public static final String GREEN_BALL = "GREEN_BALL";
|
||||
public static final String SMALL_BUSINESS_MAN_VIEW = "SMALL_BUSINESS_MAN_VIEW";
|
||||
public static final String BLANK_24x24 = "BLANK_24x24";
|
||||
public static final String USER1_32x32 = "USER1_32x32";
|
||||
public static final String DOOR_IMAGE = "DOOR_IMAGE";
|
||||
public static final String ALL_CHATS = "ALL_CHATS";
|
||||
public static final String SMALL_SCROLL_REFRESH = "SMALL_SCROLL_REFRESH";
|
||||
public static final String CO_BROWSER_TAB_TITLE = "CO_BROWSER_TAB_TITLE";
|
||||
public static final String PLUS_SIGN = "PLUS_SIGN";
|
||||
public static final String FIND_IMAGE = "FIND_IMAGE";
|
||||
public static final String USER1_MESSAGE_24x24 = "USER1_MESSAGE_24x24";
|
||||
public static final String SMALL_CHECK = "SMALL_CHECK";
|
||||
public static final String SEARCH_USER_16x16 = "SEARCH_USER_16x16";
|
||||
public static final String LOGIN_DIALOG_PASSWORD = "LOGIN_DIALOG_PASSWORD";
|
||||
public static final String TIME_LEFT = "TIME_LEFT";
|
||||
public static final String FAQ_TAB_TITLE = "FAQ_TAB_TITLE";
|
||||
public static final String ADD_TO_CHAT = "ADD_TO_CHAT";
|
||||
public static final String DELETE_BOOKMARK_ICON = "DELETE_BOOKMARK_ICON";
|
||||
public static final String FOLDER_CLOSED = "FOLDER_CLOSED";
|
||||
public static final String REJECT_CHAT = "REJECT_CHAT";
|
||||
public static final String YELLOW_FLAG_16x16 = "YELLOW_FLAG_16x16";
|
||||
public static final String ONLINE_ICO = "ONLINE_ICO";
|
||||
public static final String LINK_DELETE_16x16 = "LINK_DELETE_16x16";
|
||||
public static final String MAIL_FORWARD_16x16 = "MAIL_FORWARD_16x16";
|
||||
public static final String TELEPHONE_24x24 = "TELEPHONE_24x24";
|
||||
public static final String ADD_LINK_TO_CHAT = "ADD_LINK_TO_CHAT";
|
||||
public static final String SMALL_ABOUT_IMAGE = "SMALL_ABOUT_IMAGE";
|
||||
public static final String DESKTOP_IMAGE = "DESKTOP_IMAGE";
|
||||
public static final String MAIL_16x16 = "MAIL_16x16";
|
||||
public static final String MAIL_IMAGE_32x32 = "MAIL_IMAGE_32x32";
|
||||
public static final String ADDRESS_BOOK_16x16 = "ADDRESS_BOOK_16x16";
|
||||
public static final String YELLOW_BALL = "YELLOW_BALL";
|
||||
public static final String ERROR_DIALOG_TITLE = "ERROR_DIALOG_TITLE";
|
||||
public static final String REFRESH_IMAGE = "REFRESH_IMAGE";
|
||||
public static final String SMALL_ADD_IMAGE = "SMALL_ADD_IMAGE";
|
||||
public static final String SEND_FILE_24x24 = "SEND_FILE_24x24";
|
||||
public static final String PROFILE_IMAGE_24x24 = "PROFILE_IMAGE_24x24";
|
||||
public static final String SMALL_ENTRY = "SMALL_ENTRY";
|
||||
public static final String CLEAR_BALL_ICON = "CLEAR_BALL_ICON";
|
||||
public static final String CONFERENCE_IMAGE_24x24 = "CONFERENCE_IMAGE_24x24";
|
||||
public static final String BACKGROUND_IMAGE = "BACKGROUND_IMAGE";
|
||||
public static final String FREE_TO_CHAT_IMAGE = "FREE_TO_CHAT_IMAGE";
|
||||
public static final String SOUND_PREFERENCES_IMAGE = "SOUND_PREFERENCES_IMAGE";
|
||||
public static final String SPARK_LOGOUT_IMAGE = "SPARK_LOGOUT_IMAGE";
|
||||
public static final String PHOTO_IMAGE = "PHOTO_IMAGE";
|
||||
public static final String PLUGIN_IMAGE = "PLUGIN_IMAGE";
|
||||
public static final String SMALL_PROFILE_IMAGE = "SMALL_PROFILE_IMAGE";
|
||||
public static final String CHANGELOG_IMAGE = "CHANGELOG_IMAGE";
|
||||
public static final String README_IMAGE = "README_IMAGE";
|
||||
public static final String DOWN_OPTION_IMAGE = "DOWN_OPTION_IMAGE";
|
||||
public static final String FASTPATH_IMAGE_16x16 = "FASTPATH_IMAGE_16x16";
|
||||
public static final String FASTPATH_IMAGE_24x24 = "FASTPATH_IMAGE_24x24";
|
||||
public static final String FASTPATH_IMAGE_32x32 = "FASTPATH_IMAGE_32x32";
|
||||
public static final String FASTPATH_IMAGE_64x64 = "FASTPATH_IMAGE_64x64";
|
||||
public static final String CIRCLE_CHECK_IMAGE = "CIRCLE_CHECK_IMAGE";
|
||||
public static final String TRANSFER_IMAGE_24x24 = "TRANSFER_IMAGE_24x24";
|
||||
public static final String FASTPATH_OFFLINE_IMAGE_16x16 = "FASTPATH_OFFLINE_IMAGE_16x16";
|
||||
public static final String FASTPATH_OFFLINE_IMAGE_24x24 = "FASTPATH_OFFLINE_IMAGE_24x24";
|
||||
public static final String USER1_ADD_16x16 = "USER1_ADD_16x16";
|
||||
public static final String END_BUTTON_24x24 = "END_BUTTON_24x24";
|
||||
public static final String POWERED_BY_IMAGE = "POWERED_BY_IMAGE";
|
||||
public static final String STICKY_NOTE_IMAGE = "STICKY_NOTE_IMAGE";
|
||||
public static final String HISTORY_24x24_IMAGE = "HISTORY_24x24";
|
||||
public static final String PANE_UP_ARROW_IMAGE = "PANE_UP_ARROW_IMAGE";
|
||||
public static final String PANE_DOWN_ARROW_IMAGE = "PANE_DOWN_ARROW_IMAGE";
|
||||
public static final String CLOSE_DARK_X_IMAGE = "CLOSE_DARK_X_IMAGE";
|
||||
public static final String CLOSE_WHITE_X_IMAGE = "CLOSE_WHITE_X_IMAGE";
|
||||
|
||||
|
||||
static ClassLoader cl = SparkRes.class.getClassLoader();
|
||||
|
||||
static {
|
||||
prb = (PropertyResourceBundle)ResourceBundle.getBundle("org/jivesoftware/resource/spark");
|
||||
}
|
||||
|
||||
public static final String getString(String propertyName) {
|
||||
return prb.getString(propertyName);
|
||||
}
|
||||
|
||||
public static final ImageIcon getImageIcon(String imageName) {
|
||||
try {
|
||||
final String iconURI = getString(imageName);
|
||||
final URL imageURL = cl.getResource(iconURI);
|
||||
return new ImageIcon(imageURL);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println(imageName + " not found.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final URL getURL(String propertyName) {
|
||||
return cl.getResource(getString(propertyName));
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
JFrame frame = new JFrame();
|
||||
frame.getContentPane().setLayout(new BorderLayout());
|
||||
|
||||
JEditorPane pane = new JEditorPane();
|
||||
frame.getContentPane().add(new JScrollPane(pane));
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
Enumeration enumeration = prb.getKeys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String token = (String)enumeration.nextElement();
|
||||
String value = prb.getString(token).toLowerCase();
|
||||
if (value.endsWith(".gif") || value.endsWith(".png") || value.endsWith(".jpg") || value.endsWith("jpeg")) {
|
||||
SparkRes.getImageIcon(token);
|
||||
}
|
||||
String str = "public static final String " + token + " = \"" + token + "\";\n";
|
||||
buf.append(str);
|
||||
}
|
||||
|
||||
checkImageDir();
|
||||
pane.setText(buf.toString());
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void checkImageDir() {
|
||||
File[] files = new File("c:\\code\\liveassistant\\client\\resources\\images").listFiles();
|
||||
final int no = files != null ? files.length : 0;
|
||||
for (int i = 0; i < no; i++) {
|
||||
File imageFile = files[i];
|
||||
String name = imageFile.getName();
|
||||
|
||||
// Check to see if the name of the file exists
|
||||
boolean exists = false;
|
||||
Enumeration enumeration = prb.getKeys();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String token = (String)enumeration.nextElement();
|
||||
String value = prb.getString(token);
|
||||
if (value.endsWith(name)) {
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
System.out.println(imageFile.getAbsolutePath() + " is not used.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/java/org/jivesoftware/resource/configuration.properties
Normal file
@ -0,0 +1,16 @@
|
||||
# Default configurations for Live Assistant
|
||||
DEFAULT_APP_RESOURCE_NAME = Live Assistant
|
||||
|
||||
#Images
|
||||
CHECK_IMAGE = images/check.png
|
||||
DELETE_IMAGE = images/delete.png
|
||||
HEADER_FILE = images/header.png
|
||||
|
||||
#Namespaces
|
||||
PERSONAL_ELEMENT_NAME = private_macros
|
||||
PERSONAL_NAMESPACE = liveassistant:private
|
||||
|
||||
GLOBAL_ELEMENT_NAME = global_macros
|
||||
GLOBAL_ELEMENT_NAME = liveassistant:global
|
||||
|
||||
SPELLING_PROPERTIES = spelling/spelling.properties
|
||||
31
src/java/org/jivesoftware/resource/default.properties
Normal file
@ -0,0 +1,31 @@
|
||||
MAIN_IMAGE = images/spark.png
|
||||
APPLICATION_NAME = Spark
|
||||
SHORT_NAME = spark
|
||||
LOGIN_DIALOG_BACKGROUND_IMAGE = images/login_dialog_background.png
|
||||
TOP_BOTTOM_BACKGROUND_IMAGE = images/top_bottom_background_image.png
|
||||
SECONDARY_BACKGROUND_IMAGE = images/secondary_background_image.png
|
||||
|
||||
|
||||
# Branding only
|
||||
BRANDED_IMAGE =
|
||||
HOST_NAME =
|
||||
SHOW_POWERED_BY =
|
||||
CUSTOM =
|
||||
|
||||
|
||||
# Roster Management
|
||||
HOVER_TEXT_COLOR =
|
||||
TEXT_COLOR =
|
||||
|
||||
CONTACT_GROUP_START_COLOR =
|
||||
CONTACT_GROUP_END_COLOR =
|
||||
|
||||
TAB_START_COLOR =
|
||||
TAB_END_COLOR =
|
||||
|
||||
# Proxy Settings
|
||||
PROXY_HOST =
|
||||
PROXY_PORT =
|
||||
|
||||
# Account Disabled
|
||||
ACCOUNT_DISABLED =
|
||||
19
src/java/org/jivesoftware/resource/emotion.properties
Normal file
@ -0,0 +1,19 @@
|
||||
":)" = images/emoticons/happy.gif
|
||||
:-) = images/emoticons/happy.gif
|
||||
:( = images/emoticons/sad.gif
|
||||
:-( = images/emoticons/sad.gif
|
||||
:D = images/emoticons/grin.gif
|
||||
:x = images/emoticons/love.gif
|
||||
;\ = images/emoticons/mischief.gif
|
||||
B-) = images/emoticons/cool.gif
|
||||
]:) = images/emoticons/devil.gif
|
||||
:p = images/emoticons/silly.gif
|
||||
X-( = images/emoticons/angry.gif
|
||||
:^0 = images/emoticons/laugh.gif
|
||||
;) = images/emoticons/wink.gif
|
||||
;-) = images/emoticons/wink.gif
|
||||
:8} = images/emoticons/blush.gif
|
||||
:_| = images/emoticons/cry.gif
|
||||
?:| = images/emoticons/confused.gif
|
||||
:0 = images/emoticons/shocked.gif
|
||||
:| = images/emoticons/plain.gif
|
||||
5
src/java/org/jivesoftware/resource/sounds.properties
Normal file
@ -0,0 +1,5 @@
|
||||
# List all sound files
|
||||
INCOMING_USER = sounds/chat_request.wav
|
||||
TRAY_SHOWING = sounds/bell.wav
|
||||
OPENING = sounds/opening.wav
|
||||
CLOSING = sounds/close.wav
|
||||
240
src/java/org/jivesoftware/resource/spark.properties
Normal file
@ -0,0 +1,240 @@
|
||||
APP_NAME = Spark
|
||||
VERSION = Version 1.0 Release
|
||||
|
||||
SPARK_IMAGE = images/spark.png
|
||||
WELCOME = Welcome
|
||||
ID_CARD_48x48 = images/id_card.png
|
||||
|
||||
# LOGIN DIALOG
|
||||
LOGIN_DIALOG_LOGIN = &Login
|
||||
LOGIN_DIALOG_QUIT = &Quit
|
||||
LOGIN_DIALOG_USERNAME = &Username:
|
||||
LOGIN_DIALOG_PASSWORD = &Password:
|
||||
LOGIN_DIALOG_WORKSPACE = &Workgroup:
|
||||
LOGIN_DIALOG_LOGIN_TITLE = Spark
|
||||
LOGIN_DIALOG_AUTHENTICATING = Authenticating...
|
||||
|
||||
#MainWindow
|
||||
MAIN_IMAGE = images/message.png
|
||||
MAIN_IMAGE_ICO = images/icon_16.ico
|
||||
SMALL_CHECK = images/smallCheck.png
|
||||
SMALL_DELETE = images/smallDelete.png
|
||||
AVAILABLE_USER = images/availableUser.png
|
||||
AWAY_USER = images/awayUser.png
|
||||
FIND_IMAGE = images/find.png
|
||||
SMALL_ADD_IMAGE = images/small_add.png
|
||||
DOCUMENT_EXCHANGE_IMAGE = images/document_exchange.png
|
||||
SMALL_DOCUMENT_ADD = images/document_add.png
|
||||
SMALL_CIRCLE_DELETE = images/small_delete.png
|
||||
SMALL_DOCUMENT_VIEW = images/document_view.png
|
||||
SMALL_USER1_MESSAGE = images/user1_message-16x16.png
|
||||
USER1_MESSAGE_24x24 = images/user1_message-24x24.png
|
||||
SMALL_USER1_TIME = images/user1_time.png
|
||||
SMALL_USER1_NEW = images/user1_new.png
|
||||
SMALL_USER1_STOPWATCH = images/stopwatch_pause.png
|
||||
SMALL_USER1_MOBILEPHONE = images/user1_mobilephone.png
|
||||
SMALL_USER1_INFORMATION = images/user1_information.png
|
||||
SMALL_ENTRY = images/small_entry.gif
|
||||
SMALL_AGENT_IMAGE = images/small_agent.png
|
||||
CHATTING_AGENT_IMAGE = images/user1.png
|
||||
CHATTING_CUSTOMER_IMAGE = images/user2.png
|
||||
INFORMATION_IMAGE = images/information.png
|
||||
BLANK_IMAGE = images/blank.gif
|
||||
USER_HEADSET_24x24 = images/user_headset24.png
|
||||
FOLDER_CLOSED = images/folder_closed.png
|
||||
FOLDER = images/folder.png
|
||||
SMALL_PIN_BLUE = images/pin_blue.png
|
||||
SMALL_DATA_FIND_IMAGE = images/data_find.png
|
||||
SMALL_BUSINESS_MAN_VIEW = images/businessman_view.png
|
||||
SMALL_ALL_AGENTS_IMAGE = images/user1_earth.png
|
||||
SMALL_WORKGROUP_QUEUE_IMAGE = images/users_into.png
|
||||
SMALL_ALL_CHATS_IMAGE = images/users_family.png
|
||||
SMALL_CURRENT_AGENTS = images/users2.png
|
||||
HELP2_24x24 = images/help_24x24.png
|
||||
SMALL_ALARM_CLOCK = images/alarmclock.png
|
||||
SMALL_SCROLL_REFRESH = images/scroll_refresh.png
|
||||
SMALL_QUESTION = images/help_16x16.png
|
||||
USER1_32x32 = images/User1_32x32.png
|
||||
DATA_DELETE_16x16 = images/data_delete.png
|
||||
DATA_REFRESH_16x16 = images/data_refresh.png
|
||||
USER1_BACK_16x16 = images/user1_back.png
|
||||
FONT_16x16 = images/font.png
|
||||
DOCUMENT_FIND_16x16 = images/document_find.png
|
||||
DOCUMENT_INFO_32x32 = images/document_info.png
|
||||
DOCUMENT_16x16 = images/document.png
|
||||
SMALL_CLOSE_BUTTON = images/deleteitem.gif
|
||||
COPY_16x16 = images/copy.png
|
||||
BLANK_24x24 = images/blank_24x24.png
|
||||
PUSH_URL_16x16 = images/earth_connection-16x16.png
|
||||
LINK_16x16 = images/link-16x16.png
|
||||
LINK_DELETE_16x16 = images/link_delete.png
|
||||
EARTH_LOCK_16x16 = images/earth_lock-16x16.png
|
||||
LOCK_16x16 = images/lock-16x16.png
|
||||
LOCK_UNLOCK_16x16 = images/lock_unlock-16x16.png
|
||||
ONLINE_ICO = images/icon1.ico
|
||||
OFFLINE_ICO = images/icon2.ico
|
||||
INFORMATION_ICO = images/icon3.ico
|
||||
SAVE_AS_16x16 = images/save_as.png
|
||||
NOTE_EDIT_16x16 = images/note_edit.png
|
||||
ADDRESS_BOOK_16x16 = images/address_book.png
|
||||
MEGAPHONE_16x16 = images/megaphone.png
|
||||
EARTH_VIEW_16x16 = images/earth_view.png
|
||||
HISTORY_16x16 = images/history.png
|
||||
DOWNLOAD_16x16 = images/download.png
|
||||
RED_FLAG_16x16 = images/flag_red.png
|
||||
GREEN_FLAG_16x16 = images/flag_green.png
|
||||
YELLOW_FLAG_16x16 = images/flag_yellow.png
|
||||
FUNNEL_DOWN_16x16 = images/funnel_down.png
|
||||
MAIL_16x16 = images/mail_16x16.png
|
||||
MAIL_FORWARD_16x16 = images/mail_forward_16x16.png
|
||||
MAIL_INTO_16x16 = images/mail_into_16x16.png
|
||||
RED_BALL = images/red-ball.png
|
||||
GREEN_BALL = images/green-ball.png
|
||||
BLUE_BALL = images/blue-ball.png
|
||||
YELLOW_BALL = images/yellow-ball.png
|
||||
PAWN_GLASS_GREEN = images/pawn_glass_green.png
|
||||
PAWN_GLASS_RED = images/pawn_glass_red.png
|
||||
PAWN_GLASS_WHITE = images/pawn_glass_white.png
|
||||
PAWN_GLASS_YELLOW = images/pawn_glass_yellow.png
|
||||
PLUS_SIGN = images/plus-sign.png
|
||||
MINUS_SIGN = images/minus-sign.png
|
||||
MAGICIAN_IMAGE = images/magician.png
|
||||
FIND_TEXT_IMAGE = images/find_text.png
|
||||
LOGIN_KEY_IMAGE = images/login-key.png
|
||||
BRICKWALL_IMAGE = images/brickwall.png
|
||||
MODERATOR_IMAGE = images/moderator.gif
|
||||
DESKTOP_IMAGE = images/desktop.png
|
||||
SPELL_CHECK_IMAGE = images/text_ok.png
|
||||
BUSY_IMAGE = images/busy.gif
|
||||
CLOSE_IMAGE = images/close.png
|
||||
VIEW_IMAGE = images/view.png
|
||||
MOBILE_PHONE_IMAGE = images/mobilephone.png
|
||||
ON_PHONE_IMAGE = images/on-phone.png
|
||||
REFRESH_IMAGE = images/refresh.png
|
||||
CLOSE_WHITE_X_IMAGE = images/close_white.png
|
||||
CLOSE_DARK_X_IMAGE = images/close_dark.png
|
||||
|
||||
|
||||
# Global Values
|
||||
ERROR_INVALID_WORKGROUP = The workgroup is not valid. Please use a valid workgroup.
|
||||
ERROR_DIALOG_TITLE = Login Error
|
||||
INVALID_USERNAME_PASSWORD = Invalid username or password.
|
||||
SERVER_UNAVAILABLE = Can't connect to server: invalid name or server not reachable.
|
||||
UNRECOVERABLE_ERROR = Invalid username or password.
|
||||
|
||||
#Chat Window Images
|
||||
|
||||
|
||||
|
||||
#Chat window text
|
||||
SEND = &Send
|
||||
ADD_TO_KB = You can assign any response as either a question or an answer add them directly to the knowledge base for future reference.
|
||||
|
||||
#Kbase Window
|
||||
GO = &Go
|
||||
ADD_TO_CHAT = &Add document
|
||||
ADD_LINK_TO_CHAT = Add &link
|
||||
VIEW = &View
|
||||
SEARCH = &Search:
|
||||
|
||||
#Chat Queue
|
||||
ACCEPT_CHAT = &Accept
|
||||
REJECT_CHAT = &Refuse
|
||||
TIME_LEFT = Time left:
|
||||
|
||||
#MainWindow
|
||||
MAIN_TITLE = Spark
|
||||
TOOLBOX = Toolbox
|
||||
CHAT_QUEUE = Chat Queue
|
||||
CURRENT_CHATS = My Chats
|
||||
CURRENT_AGENTS = Online Agents
|
||||
ALL_CHATS = All Chats
|
||||
WORKGROUP_QUEUE = Queues
|
||||
CHAT_WORKSPACE = Chat Workspace
|
||||
|
||||
#GroupChat
|
||||
CREATE_FAQ_ENTRY = Create a new FAQ entry?
|
||||
CREATE_FAQ_TITLE = Create New FAQ
|
||||
FAQ_TAB_TITLE = Analyzer
|
||||
KNOWLEDGE_BASE_TAB_TITLE = Search
|
||||
PROFILE_TAB_TITLE = Profile
|
||||
CO_BROWSER_TAB_TITLE = Co-Browser
|
||||
FORUM_TAB_TITLE = Forums
|
||||
|
||||
#Images
|
||||
CONFERENCE_IMAGE_24x24 = images/conference_24x24.png
|
||||
CONFERENCE_IMAGE_16x16 = images/conference_16x16.png
|
||||
PROFILE_IMAGE_24x24 = images/profile_24x24.png
|
||||
SEARCH_USER_16x16 = images/search_user_16x16.png
|
||||
SEND_FILE_24x24 = images/send_file_24x24.png
|
||||
ADD_IMAGE_24x24 = images/add_24x24.png
|
||||
TELEPHONE_24x24 = images/telephone_24x24.png
|
||||
IM_DND = images/im_dnd.png
|
||||
IM_AWAY = images/im_away.png
|
||||
MESSAGE_AWAY = images/message_away.png
|
||||
MESSAGE_DND = images/message_dnd.png
|
||||
ERASER_IMAGE = images/eraser.gif
|
||||
TOOLBAR_BACKGROUND = images/toolbar.png
|
||||
TRAFFIC_LIGHT_IMAGE = images/traffic-light.png
|
||||
SERVER_ICON = images/server.png
|
||||
BOOKMARK_ICON = images/bookmark.png
|
||||
ADD_BOOKMARK_ICON = images/bookmark_add.png
|
||||
DELETE_BOOKMARK_ICON = images/bookmark_delete.png
|
||||
CLEAR_BALL_ICON = images/bullet_ball_glass_clear.png
|
||||
CALL_ICON = images/call.png
|
||||
PROFILE_ICON = images/profile.png
|
||||
SEND_FILE_ICON = images/document_into.png
|
||||
ADD_CONTACT_IMAGE = images/add_contact.png
|
||||
JOIN_GROUPCHAT_IMAGE = images/join_groupchat.png
|
||||
DOWN_ARROW_IMAGE = images/down_arrow.gif
|
||||
PRINTER_IMAGE_16x16 = images/printer.png
|
||||
SEND_MAIL_IMAGE_16x16 = images/sendmail.png
|
||||
SEARCH_IMAGE_32x32 = images/search_32x32.png
|
||||
MAIL_IMAGE_32x32 = images/mail_32x32.png
|
||||
PREFERENCES_IMAGE = images/preferences.png
|
||||
NOTEBOOK_IMAGE = images/notebook.png
|
||||
TEXT_BOLD = images/text_bold.png
|
||||
TEXT_ITALIC = images/text_italics.png
|
||||
TEXT_UNDERLINE = images/text_underlined.png
|
||||
TEXT_NORMAL = images/text_normal.png
|
||||
SMALL_USER_ENTER = images/smallUserEnter.png
|
||||
SMALL_USER_DELETE = images/smallUserDelete.png
|
||||
QUESTIONS_ANSWERS = images/questionsAnswers.png
|
||||
SMALL_MESSAGE_IMAGE = images/message.png
|
||||
SMALL_MESSAGE_EDIT_IMAGE = images/message_edit.png
|
||||
SMALL_ABOUT_IMAGE = images/about.png
|
||||
DOOR_IMAGE = images/door.gif
|
||||
STAR_BLUE_IMAGE = images/star_blue.png
|
||||
STAR_RED_IMAGE = images/star_red.png
|
||||
STAR_GREY_IMAGE = images/star_grey.png
|
||||
STAR_YELLOW_IMAGE = images/star_yellow.png
|
||||
STAR_GREEN_IMAGE = images/star_green.png
|
||||
LEFT_ARROW_IMAGE = images/arrow_left_green.png
|
||||
RIGHT_ARROW_IMAGE = images/arrow_right_green.png
|
||||
BACKGROUND_IMAGE = images/background.png
|
||||
FREE_TO_CHAT_IMAGE = images/im_free_chat.png
|
||||
SOUND_PREFERENCES_IMAGE = images/text_loudspeaker.png
|
||||
SPARK_LOGOUT_IMAGE = images/spark_100.jpg
|
||||
PHOTO_IMAGE = images/photo_scenery.png
|
||||
PLUGIN_IMAGE = images/plugin-16x16.gif
|
||||
SMALL_PROFILE_IMAGE = images/small_profile.png
|
||||
CHANGELOG_IMAGE = images/doc-changelog-16x16.gif
|
||||
README_IMAGE = images/doc-readme-16x16.gif
|
||||
DOWN_OPTION_IMAGE = images/option.png
|
||||
STICKY_NOTE_IMAGE = images/sticky.png
|
||||
HISTORY_24x24 = images/history-24x24.png
|
||||
PANE_UP_ARROW_IMAGE = images/metallic_up.png
|
||||
PANE_DOWN_ARROW_IMAGE = images/metallic_down.png
|
||||
|
||||
#Fastpath Icons
|
||||
FASTPATH_IMAGE_16x16 = images/fastpath16.png
|
||||
FASTPATH_IMAGE_24x24 = images/fastpath24.png
|
||||
FASTPATH_IMAGE_32x32 = images/fastpath32.png
|
||||
FASTPATH_IMAGE-64x63 = images/fastpath64.png
|
||||
CIRCLE_CHECK_IMAGE = images/check.png
|
||||
TRANSFER_IMAGE_24x24 = images/transfer-24x24.png
|
||||
FASTPATH_OFFLINE_IMAGE_16x16 = images/fastpath16_offline.png
|
||||
FASTPATH_OFFLINE_IMAGE_24x24 = images/fastpath24_offline.png
|
||||
USER1_ADD_16x16 = images/user1_add.png
|
||||
END_BUTTON_24x24 = images/end_button_24x24.png
|
||||
POWERED_BY_IMAGE = images/powered_by.png
|
||||
103
src/java/org/jivesoftware/spark/AlertManager.java
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
|
||||
import java.awt.Window;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The AlertManager handles the delegation of Alerting based.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class AlertManager {
|
||||
|
||||
private List<Alerter> alerts = new ArrayList<Alerter>();
|
||||
|
||||
public AlertManager() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an alert.
|
||||
*
|
||||
* @param alerter the Alerter to add.
|
||||
*/
|
||||
public void addAlert(Alerter alerter) {
|
||||
alerts.add(alerter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an alerter.
|
||||
*
|
||||
* @param alerter the alerter to remove.
|
||||
*/
|
||||
public void removeAlert(Alerter alerter) {
|
||||
alerts.remove(alerter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flash the given window.
|
||||
*
|
||||
* @param window the window to flash.
|
||||
*/
|
||||
public void flashWindow(Window window) {
|
||||
final Iterator alertNotifier = ModelUtil.reverseListIterator(alerts.listIterator());
|
||||
while (alertNotifier.hasNext()) {
|
||||
final Alerter alert = (Alerter)alertNotifier.next();
|
||||
boolean handle = alert.handleNotification();
|
||||
if (handle) {
|
||||
alert.flashWindow(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash the given window, but stop flashing when the window takes focus.
|
||||
*
|
||||
* @param window the window to start flashing.
|
||||
*/
|
||||
public void flashWindowStopOnFocus(Window window) {
|
||||
final Iterator alertNotifiers = ModelUtil.reverseListIterator(alerts.listIterator());
|
||||
while (alertNotifiers.hasNext()) {
|
||||
final Alerter alert = (Alerter)alertNotifiers.next();
|
||||
boolean handle = alert.handleNotification();
|
||||
if (handle) {
|
||||
alert.flashWindowStopWhenFocused(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the flashing of the window.
|
||||
*
|
||||
* @param window the window to stop flashing.
|
||||
*/
|
||||
public void stopFlashing(Window window) {
|
||||
final Iterator alertNotifiers = ModelUtil.reverseListIterator(alerts.listIterator());
|
||||
while (alertNotifiers.hasNext()) {
|
||||
final Alerter alert = (Alerter)alertNotifiers.next();
|
||||
boolean handle = alert.handleNotification();
|
||||
if (handle) {
|
||||
alert.stopFlashing(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
51
src/java/org/jivesoftware/spark/Alerter.java
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
* Implementations of this interface define alert mechanisims based on the Operating System
|
||||
* Spark is running on.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public interface Alerter {
|
||||
|
||||
/**
|
||||
* Flash the window.
|
||||
*
|
||||
* @param window the window to flash.
|
||||
*/
|
||||
void flashWindow(Window window);
|
||||
|
||||
/**
|
||||
* Start the flashing of the given window, but stop flashing when the window takes focus.
|
||||
*
|
||||
* @param window the window to start flashing.
|
||||
*/
|
||||
void flashWindowStopWhenFocused(Window window);
|
||||
|
||||
/**
|
||||
* Stop the flashing of the given window.
|
||||
*
|
||||
* @param window the window to stop flashing.
|
||||
*/
|
||||
void stopFlashing(Window window);
|
||||
|
||||
/**
|
||||
* Return true if this <code>Alerter</code> should handle the alert request.
|
||||
*
|
||||
* @return true to handle.
|
||||
*/
|
||||
boolean handleNotification();
|
||||
|
||||
}
|
||||
98
src/java/org/jivesoftware/spark/ChatAreaSendField.java
Normal file
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.spark.ui.ChatInputEditor;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
|
||||
/**
|
||||
* Creates a Firefox Search type box that allows for icons inside of a textfield. This
|
||||
* could be used to build out your own search objects.
|
||||
*/
|
||||
public class ChatAreaSendField extends JPanel {
|
||||
private ChatInputEditor textField;
|
||||
private JButton button;
|
||||
|
||||
/**
|
||||
* Creates a new IconTextField with Icon.
|
||||
*
|
||||
* @param text the text to use on the button.
|
||||
*/
|
||||
public ChatAreaSendField(String text) {
|
||||
setLayout(new GridBagLayout());
|
||||
setBackground((Color)UIManager.get("TextPane.background"));
|
||||
|
||||
textField = new ChatInputEditor();
|
||||
textField.setBorder(null);
|
||||
setBorder(new JTextField().getBorder());
|
||||
|
||||
button = new JButton();
|
||||
|
||||
ResourceUtils.resButton(button, text);
|
||||
|
||||
add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
|
||||
|
||||
final JScrollPane pane = new JScrollPane(textField);
|
||||
pane.setBorder(null);
|
||||
add(pane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
|
||||
button.setEnabled(false);
|
||||
}
|
||||
|
||||
public JButton getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
public void enableSendButton(boolean enabled) {
|
||||
button.setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the text of the textfield.
|
||||
*
|
||||
* @param text the text.
|
||||
*/
|
||||
public void setText(String text) {
|
||||
textField.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text inside of the textfield.
|
||||
*
|
||||
* @return the text inside of the textfield.
|
||||
*/
|
||||
public String getText() {
|
||||
return textField.getText();
|
||||
}
|
||||
|
||||
public ChatInputEditor getChatInputArea() {
|
||||
return textField;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
261
src/java/org/jivesoftware/spark/ChatManager.java
Normal file
@ -0,0 +1,261 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smackx.Form;
|
||||
import org.jivesoftware.smackx.muc.MultiUserChat;
|
||||
import org.jivesoftware.spark.ui.ChatContainer;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.ChatRoomListener;
|
||||
import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
||||
import org.jivesoftware.spark.ui.ContactItem;
|
||||
import org.jivesoftware.spark.ui.ContactList;
|
||||
import org.jivesoftware.spark.ui.MessageFilter;
|
||||
import org.jivesoftware.spark.ui.conferences.RoomInvitationListener;
|
||||
import org.jivesoftware.spark.ui.rooms.ChatRoomImpl;
|
||||
import org.jivesoftware.spark.ui.rooms.GroupChatRoom;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.preference.chat.ChatPreference;
|
||||
import org.jivesoftware.sparkimpl.preference.chat.ChatPreferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the Chat Management of each individual <code>Workspace</code>. The ChatManager is responsible
|
||||
* for creation and removal of chat rooms, transcripts, and transfers and room invitations.
|
||||
*/
|
||||
public class ChatManager {
|
||||
private List messageFilters = new ArrayList();
|
||||
private final ChatContainer chatContainer;
|
||||
private List invitationListeners = new ArrayList();
|
||||
private String conferenceService;
|
||||
|
||||
/**
|
||||
* Create a new instance of ChatManager.
|
||||
*/
|
||||
public ChatManager() {
|
||||
chatContainer = new ChatContainer();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to listen for rooms opening, closing or being
|
||||
* activated( already opened, but tabbed to )
|
||||
*
|
||||
* @param listener the ChatRoomListener to add
|
||||
*/
|
||||
public void addChatRoomListener(ChatRoomListener listener) {
|
||||
getChatContainer().addChatRoomListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplace facade for chatroom. Removes a listener
|
||||
*
|
||||
* @param listener the ChatRoomListener to remove
|
||||
*/
|
||||
public void removeChatRoomListener(ChatRoomListener listener) {
|
||||
getChatContainer().removeChatRoomListener(listener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the personal 1 to 1 chat from the ChatFrame.
|
||||
*
|
||||
* @param chatRoom the ChatRoom to remove.
|
||||
*/
|
||||
public void removeChat(ChatRoom chatRoom) {
|
||||
chatContainer.closeTab(chatRoom);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all ChatRooms currently active.
|
||||
*
|
||||
* @return all ChatRooms.
|
||||
*/
|
||||
public ChatContainer getChatContainer() {
|
||||
return chatContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the MultiUserChat associated with the specified roomname.
|
||||
*
|
||||
* @param roomName the name of the chat room.
|
||||
* @return the MultiUserChat found for that room.
|
||||
*/
|
||||
public GroupChatRoom getGroupChat(String roomName) throws ChatNotFoundException {
|
||||
Iterator iter = getChatContainer().getAllChatRooms();
|
||||
while (iter.hasNext()) {
|
||||
ChatRoom chatRoom = (ChatRoom)iter.next();
|
||||
if (chatRoom instanceof GroupChatRoom) {
|
||||
GroupChatRoom groupChat = (GroupChatRoom)chatRoom;
|
||||
if (groupChat.getRoomname().equals(roomName)) {
|
||||
return groupChat;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw new ChatNotFoundException("Could not locate Group Chat Room - " + roomName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and/or opens a chat room with the specified user.
|
||||
*
|
||||
* @param userJID the jid of the user to chat with.
|
||||
* @param nickname the nickname to use for the user.
|
||||
*/
|
||||
public ChatRoom createChatRoom(String userJID, String nickname, String title) {
|
||||
ChatRoom chatRoom = null;
|
||||
try {
|
||||
chatRoom = getChatContainer().getChatRoom(userJID);
|
||||
}
|
||||
catch (ChatRoomNotFoundException e) {
|
||||
chatRoom = new ChatRoomImpl(userJID, nickname, title);
|
||||
getChatContainer().addChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
return chatRoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>ChatRoom</code> for the giving jid. If the ChatRoom is not found,
|
||||
* a new ChatRoom will be created.
|
||||
*
|
||||
* @param jid the jid of the user to chat with.
|
||||
* @return the ChatRoom.
|
||||
*/
|
||||
public ChatRoom getChatRoom(String jid) {
|
||||
ChatRoom chatRoom = null;
|
||||
try {
|
||||
chatRoom = getChatContainer().getChatRoom(jid);
|
||||
}
|
||||
catch (ChatRoomNotFoundException e) {
|
||||
ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||
ContactItem item = contactList.getContactItemByJID(jid);
|
||||
|
||||
String nickname = item.getNickname();
|
||||
chatRoom = new ChatRoomImpl(jid, nickname, nickname);
|
||||
getChatContainer().addChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
return chatRoom;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new public Conference Room.
|
||||
*
|
||||
* @param roomName the name of the room.
|
||||
* @param serviceName the service name to use (ex.conference.jivesoftware.com)
|
||||
* @return the new ChatRoom created. If an error occured, null will be returned.
|
||||
*/
|
||||
public ChatRoom createConferenceRoom(String roomName, String serviceName) {
|
||||
final MultiUserChat chatRoom = new MultiUserChat(SparkManager.getConnection(), roomName + "@" + serviceName);
|
||||
|
||||
final GroupChatRoom room = new GroupChatRoom(chatRoom);
|
||||
|
||||
try {
|
||||
ChatPreferences chatPref = (ChatPreferences)SparkManager.getPreferenceManager().getPreferenceData(ChatPreference.NAMESPACE);
|
||||
chatRoom.create(chatPref.getNickname());
|
||||
|
||||
// Send an empty room configuration form which indicates that we want
|
||||
// an instant room
|
||||
chatRoom.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
|
||||
}
|
||||
catch (XMPPException e1) {
|
||||
Log.error("Unable to send conference room chat configuration form.", e1);
|
||||
return null;
|
||||
}
|
||||
|
||||
getChatContainer().addChatRoom(room);
|
||||
return room;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new <code>MessageFilter</code>.
|
||||
*
|
||||
* @param filter the MessageFilter.
|
||||
*/
|
||||
public void addMessageFilter(MessageFilter filter) {
|
||||
messageFilters.add(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a <code>MessageFilter</code>.
|
||||
*
|
||||
* @param filter the MessageFilter.
|
||||
*/
|
||||
public void removeMessageFilter(MessageFilter filter) {
|
||||
messageFilters.remove(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Collection of MessageFilters registered to Spark.
|
||||
*
|
||||
* @return the Collection of MessageFilters.
|
||||
*/
|
||||
public Collection getMessageFilters() {
|
||||
return messageFilters;
|
||||
}
|
||||
|
||||
public void filterIncomingMessage(Message message) {
|
||||
// Fire Message Filters
|
||||
final ChatManager chatManager = SparkManager.getChatManager();
|
||||
Iterator filters = chatManager.getMessageFilters().iterator();
|
||||
while (filters.hasNext()) {
|
||||
((MessageFilter)filters.next()).filterIncoming(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void filterOutgoingMessage(Message message) {
|
||||
// Fire Message Filters
|
||||
final ChatManager chatManager = SparkManager.getChatManager();
|
||||
Iterator filters = chatManager.getMessageFilters().iterator();
|
||||
while (filters.hasNext()) {
|
||||
((MessageFilter)filters.next()).filterOutgoing(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void addInvitationListener(RoomInvitationListener listener) {
|
||||
invitationListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeInvitationListener(RoomInvitationListener listener) {
|
||||
invitationListeners.remove(listener);
|
||||
}
|
||||
|
||||
public Collection getInvitationListeners() {
|
||||
return invitationListeners;
|
||||
}
|
||||
|
||||
public String getDefaultConferenceService() {
|
||||
if (conferenceService == null) {
|
||||
try {
|
||||
Collection col = MultiUserChat.getServiceNames(SparkManager.getConnection());
|
||||
if (col.size() > 0) {
|
||||
conferenceService = (String)col.iterator().next();
|
||||
}
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
return conferenceService;
|
||||
}
|
||||
}
|
||||
29
src/java/org/jivesoftware/spark/ChatNotFoundException.java
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
|
||||
/**
|
||||
* Thrown when a Chat was not found.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class ChatNotFoundException extends Exception {
|
||||
|
||||
public ChatNotFoundException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ChatNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
604
src/java/org/jivesoftware/spark/PluginManager.java
Normal file
@ -0,0 +1,604 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.jivesoftware.MainWindowListener;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.spark.plugin.Plugin;
|
||||
import org.jivesoftware.spark.plugin.PluginClassLoader;
|
||||
import org.jivesoftware.spark.plugin.PublicPlugin;
|
||||
import org.jivesoftware.spark.util.URLFileSystem;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
* This manager is responsible for the loading of all Plugins and Workspaces within Spark environment.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class PluginManager implements MainWindowListener {
|
||||
private final List plugins = new LinkedList();
|
||||
private final List publicPlugins = new ArrayList();
|
||||
private static PluginManager singleton;
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
/**
|
||||
* The root Plugins Directory.
|
||||
*/
|
||||
public static File PLUGINS_DIRECTORY = new File(Spark.getBinDirectory().getParent(), "plugins").getAbsoluteFile();
|
||||
|
||||
private PluginClassLoader classLoader;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of <CODE>PluginManager</CODE>,
|
||||
* creating it if necessary.
|
||||
* <p/>
|
||||
*
|
||||
* @return the singleton instance of <Code>PluginManager</CODE>
|
||||
*/
|
||||
public static PluginManager getInstance() {
|
||||
// Synchronize on LOCK to ensure that we don't end up creating
|
||||
// two singletons.
|
||||
synchronized (LOCK) {
|
||||
if (null == singleton) {
|
||||
PluginManager controller = new PluginManager();
|
||||
singleton = controller;
|
||||
return controller;
|
||||
}
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
private PluginManager() {
|
||||
SparkManager.getMainWindow().addMainWindowListener(this);
|
||||
|
||||
// Create the extension directory if one does not exist.
|
||||
if (!PLUGINS_DIRECTORY.exists()) {
|
||||
PLUGINS_DIRECTORY.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all {@link Plugin} from the agent plugins.xml and extension lib.
|
||||
*/
|
||||
public void loadPlugins() {
|
||||
// Delete all old plugins
|
||||
File[] oldFiles = PLUGINS_DIRECTORY.listFiles();
|
||||
final int no = oldFiles != null ? oldFiles.length : 0;
|
||||
for (int i = 0; i < no; i++) {
|
||||
File file = oldFiles[i];
|
||||
if (file.isDirectory()) {
|
||||
// Check to see if it has an associated .jar
|
||||
File jarFile = new File(PLUGINS_DIRECTORY, file.getName() + ".jar");
|
||||
if (!jarFile.exists()) {
|
||||
uninstall(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateClasspath();
|
||||
|
||||
// At the moment, the plug list is hardcode internally until I begin
|
||||
// using external property files. All depends on deployment.
|
||||
final URL url = getClass().getClassLoader().getResource("META-INF/plugins.xml");
|
||||
try {
|
||||
InputStreamReader reader = new InputStreamReader(url.openStream());
|
||||
loadInternalPlugins(reader);
|
||||
}
|
||||
catch (IOException e) {
|
||||
Log.error("Could not load plugins.xml file.");
|
||||
}
|
||||
|
||||
// Load extension plugins
|
||||
loadPublicPlugins();
|
||||
|
||||
// For development purposes, load the plugin specified by -Dplugin=...
|
||||
String plugin = System.getProperty("plugin");
|
||||
if (plugin != null) {
|
||||
StringTokenizer st = new StringTokenizer(plugin, ", ", false);
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
File pluginXML = new File(token);
|
||||
loadPublicPlugin(pluginXML.getParentFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads public plugins.
|
||||
*
|
||||
* @param pluginDir the directory of the expanded public plugin.
|
||||
* @return the new Plugin model for the Public Plugin.
|
||||
*/
|
||||
private Plugin loadPublicPlugin(File pluginDir) {
|
||||
File pluginFile = new File(pluginDir, "plugin.xml");
|
||||
SAXReader saxReader = new SAXReader();
|
||||
Document pluginXML = null;
|
||||
try {
|
||||
pluginXML = saxReader.read(pluginFile);
|
||||
}
|
||||
catch (DocumentException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
|
||||
Plugin pluginClass = null;
|
||||
|
||||
List plugins = pluginXML.selectNodes("/plugin");
|
||||
Iterator iter = plugins.iterator();
|
||||
while (iter.hasNext()) {
|
||||
PublicPlugin publicPlugin = new PublicPlugin();
|
||||
|
||||
String clazz = null;
|
||||
String name = null;
|
||||
try {
|
||||
Element plugin = (Element)iter.next();
|
||||
|
||||
String minSparkVersion = null;
|
||||
try {
|
||||
minSparkVersion = plugin.selectSingleNode("minSparkVersion").getText();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
name = plugin.selectSingleNode("name").getText();
|
||||
clazz = plugin.selectSingleNode("class").getText();
|
||||
publicPlugin.setPluginClass(clazz);
|
||||
publicPlugin.setName(name);
|
||||
|
||||
try {
|
||||
String version = plugin.selectSingleNode("version").getText();
|
||||
publicPlugin.setVersion(version);
|
||||
|
||||
String author = plugin.selectSingleNode("author").getText();
|
||||
publicPlugin.setAuthor(author);
|
||||
|
||||
String email = plugin.selectSingleNode("email").getText();
|
||||
publicPlugin.setEmail(email);
|
||||
|
||||
String description = plugin.selectSingleNode("description").getText();
|
||||
publicPlugin.setDescription(description);
|
||||
|
||||
String homePage = plugin.selectSingleNode("homePage").getText();
|
||||
publicPlugin.setHomePage(homePage);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.debug("We can ignore these.");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
pluginClass = (Plugin)getParentClassLoader().loadClass(clazz).newInstance();
|
||||
Log.debug(name + " has been loaded.");
|
||||
publicPlugin.setPluginDir(pluginDir);
|
||||
publicPlugins.add(publicPlugin);
|
||||
|
||||
|
||||
registerPlugin(pluginClass);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("Unable to load plugin " + clazz + ".", e);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.error("Unable to load plugin " + clazz + ".", ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return pluginClass;
|
||||
}
|
||||
|
||||
private void loadInternalPlugins(InputStreamReader reader) {
|
||||
SAXReader saxReader = new SAXReader();
|
||||
Document pluginXML = null;
|
||||
try {
|
||||
pluginXML = saxReader.read(reader);
|
||||
}
|
||||
catch (DocumentException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
List plugins = pluginXML.selectNodes("/plugins/plugin");
|
||||
Iterator iter = plugins.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
||||
|
||||
String clazz = null;
|
||||
String name = null;
|
||||
try {
|
||||
Element plugin = (Element)iter.next();
|
||||
|
||||
|
||||
name = plugin.selectSingleNode("name").getText();
|
||||
clazz = plugin.selectSingleNode("class").getText();
|
||||
|
||||
|
||||
Plugin pluginClass = (Plugin)Class.forName(clazz).newInstance();
|
||||
Log.debug(name + " has been loaded. Internal plugin.");
|
||||
|
||||
registerPlugin(pluginClass);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.error("Unable to load plugin " + clazz + ".", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateClasspath() {
|
||||
try {
|
||||
classLoader = new PluginClassLoader(getParentClassLoader(), PLUGINS_DIRECTORY);
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
Log.error("Error updating classpath.", e);
|
||||
}
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the plugin classloader.
|
||||
*
|
||||
* @return the plugin classloader.
|
||||
*/
|
||||
public ClassLoader getPluginClassLoader() {
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a plugin.
|
||||
*
|
||||
* @param plugin the plugin to register.
|
||||
*/
|
||||
public void registerPlugin(Plugin plugin) {
|
||||
plugins.add(plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a plugin from the plugin list.
|
||||
*
|
||||
* @param plugin the plugin to remove.
|
||||
*/
|
||||
public void removePlugin(Plugin plugin) {
|
||||
plugins.remove(plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Collection of Plugins.
|
||||
*
|
||||
* @return a Collection of Plugins.
|
||||
*/
|
||||
public Collection getPlugins() {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instance of the plugin class initialized during startup.
|
||||
*
|
||||
* @param communicatorPlugin the plugin to find.
|
||||
* @return the instance of the plugin.
|
||||
*/
|
||||
public Plugin getPlugin(Class communicatorPlugin) {
|
||||
Iterator iter = getPlugins().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Plugin plugin = (Plugin)iter.next();
|
||||
if (plugin.getClass() == communicatorPlugin) {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and initalizes all Plugins.
|
||||
*
|
||||
* @see Plugin
|
||||
*/
|
||||
public void initializePlugins() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final Iterator iter = plugins.iterator();
|
||||
while (iter.hasNext()) {
|
||||
long start = System.currentTimeMillis();
|
||||
Plugin plugin = (Plugin)iter.next();
|
||||
Log.debug("Trying to initialize " + plugin);
|
||||
plugin.initialize();
|
||||
long end = System.currentTimeMillis();
|
||||
Log.debug("Took " + (end - start) + " ms. to load " + plugin);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
final Iterator pluginIter = plugins.iterator();
|
||||
while (pluginIter.hasNext()) {
|
||||
Plugin plugin = (Plugin)pluginIter.next();
|
||||
try {
|
||||
plugin.shutdown();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.warning("Exception on shutdown of plugin.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mainWindowActivated() {
|
||||
}
|
||||
|
||||
public void mainWindowDeactivated() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates the best class loader based on context (see class description).
|
||||
*
|
||||
* @return The best parent classloader to use
|
||||
*/
|
||||
private ClassLoader getParentClassLoader() {
|
||||
ClassLoader parent = Thread.currentThread().getContextClassLoader();
|
||||
if (parent == null) {
|
||||
parent = this.getClass().getClassLoader();
|
||||
if (parent == null) {
|
||||
parent = ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
private void expandNewPlugins() {
|
||||
File[] jars = PLUGINS_DIRECTORY.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
boolean accept = false;
|
||||
String smallName = name.toLowerCase();
|
||||
if (smallName.endsWith(".jar")) {
|
||||
accept = true;
|
||||
}
|
||||
return accept;
|
||||
}
|
||||
});
|
||||
|
||||
// Do nothing if no jar or zip files were found
|
||||
if (jars == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < jars.length; i++) {
|
||||
if (jars[i].isFile()) {
|
||||
File file = jars[i];
|
||||
|
||||
URL url = null;
|
||||
try {
|
||||
url = file.toURL();
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
String name = URLFileSystem.getName(url);
|
||||
File directory = new File(PLUGINS_DIRECTORY, name);
|
||||
if (directory.exists() && directory.isDirectory()) {
|
||||
// Check to see if directory contains the plugin.xml file.
|
||||
// If not, delete directory.
|
||||
File pluginXML = new File(directory, "plugin.xml");
|
||||
if (pluginXML.exists()) {
|
||||
if (pluginXML.lastModified() < file.lastModified()) {
|
||||
uninstall(directory);
|
||||
unzipPlugin(file, directory);
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
uninstall(directory);
|
||||
}
|
||||
else {
|
||||
// Unzip contents into directory
|
||||
unzipPlugin(file, directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadPublicPlugins() {
|
||||
// First, expand all plugins that have yet to be expanded.
|
||||
expandNewPlugins();
|
||||
|
||||
|
||||
File[] files = PLUGINS_DIRECTORY.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return dir.isDirectory();
|
||||
}
|
||||
});
|
||||
|
||||
// Do nothing if no jar or zip files were found
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File file = files[i];
|
||||
|
||||
File pluginXML = new File(file, "plugin.xml");
|
||||
if (pluginXML.exists()) {
|
||||
try {
|
||||
classLoader.addPlugin(file);
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
Log.error("Unable to load dirs", e);
|
||||
}
|
||||
|
||||
loadPublicPlugin(file);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds and installs a new plugin into Spark.
|
||||
*
|
||||
* @param plugin the plugin to install.
|
||||
* @throws Exception thrown if there was a problem loading the plugin.
|
||||
*/
|
||||
public void addPlugin(PublicPlugin plugin) throws Exception {
|
||||
expandNewPlugins();
|
||||
|
||||
URL url = new URL(plugin.getDownloadURL());
|
||||
String name = URLFileSystem.getName(url);
|
||||
File pluginDownload = new File(PluginManager.PLUGINS_DIRECTORY, name);
|
||||
|
||||
classLoader.addPlugin(pluginDownload);
|
||||
Plugin pluginClass = loadPublicPlugin(pluginDownload);
|
||||
Log.debug("Trying to initialize " + pluginClass);
|
||||
pluginClass.initialize();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unzips a plugin from a JAR file into a directory. If the JAR file
|
||||
* isn't a plugin, this method will do nothing.
|
||||
*
|
||||
* @param file the JAR file
|
||||
* @param dir the directory to extract the plugin to.
|
||||
*/
|
||||
private void unzipPlugin(File file, File dir) {
|
||||
try {
|
||||
ZipFile zipFile = new JarFile(file);
|
||||
// Ensure that this JAR is a plugin.
|
||||
if (zipFile.getEntry("plugin.xml") == null) {
|
||||
return;
|
||||
}
|
||||
dir.mkdir();
|
||||
for (Enumeration e = zipFile.entries(); e.hasMoreElements();) {
|
||||
JarEntry entry = (JarEntry)e.nextElement();
|
||||
File entryFile = new File(dir, entry.getName());
|
||||
// Ignore any manifest.mf entries.
|
||||
if (entry.getName().toLowerCase().endsWith("manifest.mf")) {
|
||||
continue;
|
||||
}
|
||||
if (!entry.isDirectory()) {
|
||||
entryFile.getParentFile().mkdirs();
|
||||
FileOutputStream out = new FileOutputStream(entryFile);
|
||||
InputStream zin = zipFile.getInputStream(entry);
|
||||
byte[] b = new byte[512];
|
||||
int len = 0;
|
||||
while ((len = zin.read(b)) != -1) {
|
||||
out.write(b, 0, len);
|
||||
}
|
||||
out.flush();
|
||||
out.close();
|
||||
zin.close();
|
||||
}
|
||||
}
|
||||
zipFile.close();
|
||||
zipFile = null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.warning("Error unzipping plugin", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection of all public plugins.
|
||||
*
|
||||
* @return the collection of public plugins.
|
||||
*/
|
||||
public List getPublicPlugins() {
|
||||
return publicPlugins;
|
||||
}
|
||||
|
||||
private void uninstall(File pluginDir) {
|
||||
File[] files = pluginDir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
File f = files[i];
|
||||
if (f.isFile()) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
|
||||
File libDir = new File(pluginDir, "lib");
|
||||
|
||||
File[] libs = libDir.listFiles();
|
||||
final int no = libs != null ? libs.length : 0;
|
||||
for (int i = 0; i < no; i++) {
|
||||
File f = libs[i];
|
||||
f.delete();
|
||||
}
|
||||
|
||||
libDir.delete();
|
||||
|
||||
pluginDir.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and uninstall a plugin from Spark.
|
||||
*
|
||||
* @param plugin the plugin to uninstall.
|
||||
*/
|
||||
public void removePlugin(PublicPlugin plugin) {
|
||||
PluginManager pluginManager = PluginManager.getInstance();
|
||||
List plugins = pluginManager.getPublicPlugins();
|
||||
Iterator iter = new ArrayList(plugins).iterator();
|
||||
while (iter.hasNext()) {
|
||||
PublicPlugin installedPlugin = (PublicPlugin)iter.next();
|
||||
if (plugin.getName().equals(installedPlugin.getName())) {
|
||||
plugins.remove(installedPlugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified plugin is installed.
|
||||
*
|
||||
* @param plugin the plugin to check.
|
||||
* @return true if installed.
|
||||
*/
|
||||
public static boolean isInstalled(PublicPlugin plugin) {
|
||||
PluginManager pluginManager = PluginManager.getInstance();
|
||||
List plugins = pluginManager.getPublicPlugins();
|
||||
Iterator iter = plugins.iterator();
|
||||
while (iter.hasNext()) {
|
||||
PublicPlugin installedPlugin = (PublicPlugin)iter.next();
|
||||
if (plugin.getName().equals(installedPlugin.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
358
src/java/org/jivesoftware/spark/SessionManager.java
Normal file
@ -0,0 +1,358 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jdesktop.jdic.systeminfo.SystemInfo;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.StreamError;
|
||||
import org.jivesoftware.smack.provider.ProviderManager;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.PrivateDataManager;
|
||||
import org.jivesoftware.smackx.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.packet.DiscoverItems;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.PresenceListener;
|
||||
import org.jivesoftware.spark.ui.status.StatusItem;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.plugin.manager.Features;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* This manager is responsible for the handling of the XMPPConnection used within Spark. This is used
|
||||
* for the changing of the users presence, the handling of connection errors and the ability to add
|
||||
* presence listeners and retrieve the connection used in Spark.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public final class SessionManager implements ConnectionListener {
|
||||
private XMPPConnection connection;
|
||||
private PrivateDataManager personalDataManager;
|
||||
|
||||
private String serverAddress;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
private String JID;
|
||||
|
||||
private List presenceListeners = new ArrayList();
|
||||
|
||||
private String userBareAddress;
|
||||
private boolean unavaliable = false;
|
||||
private DiscoverItems discoverItems;
|
||||
|
||||
|
||||
public SessionManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes session.
|
||||
*
|
||||
* @param connection the XMPPConnection used in this session.
|
||||
* @param username the agents username.
|
||||
* @param password the agents password.
|
||||
*/
|
||||
public void initializeSession(XMPPConnection connection, String username, String password) {
|
||||
this.connection = connection;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.userBareAddress = StringUtils.parseBareAddress(connection.getUser());
|
||||
|
||||
// create workgroup session
|
||||
personalDataManager = new PrivateDataManager(getConnection());
|
||||
|
||||
LocalPreferences localPref = SettingsManager.getLocalPreferences();
|
||||
// Start Idle listener
|
||||
if (localPref.isIdleOn()) {
|
||||
int delay = localPref.getSecondIdleTime() * 60000;
|
||||
if (Spark.isWindows()) {
|
||||
setIdleListener(delay);
|
||||
}
|
||||
}
|
||||
|
||||
// Discover items
|
||||
discoverItems();
|
||||
|
||||
ProviderManager.addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the initial service discovery.
|
||||
*/
|
||||
private void discoverItems() {
|
||||
ServiceDiscoveryManager disco = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
|
||||
try {
|
||||
discoverItems = disco.discoverItems(SparkManager.getConnection().getServiceName());
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the XMPPConnection used for this session.
|
||||
*
|
||||
* @return the XMPPConnection used for this session.
|
||||
*/
|
||||
public XMPPConnection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the PrivateDataManager responsible for handling all private data for individual
|
||||
* agents.
|
||||
*
|
||||
* @return the PrivateDataManager responsible for handling all private data for individual
|
||||
* agents.
|
||||
*/
|
||||
public PrivateDataManager getPersonalDataManager() {
|
||||
return personalDataManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the host for this connection.
|
||||
*
|
||||
* @return the connection host.
|
||||
*/
|
||||
public String getServerAddress() {
|
||||
return serverAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the server address
|
||||
*
|
||||
* @param address the address of the server.
|
||||
*/
|
||||
public void setServerAddress(String address) {
|
||||
this.serverAddress = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify agent the connection was closed due to an exception.
|
||||
*
|
||||
* @param ex the Exception that took place.
|
||||
*/
|
||||
public void connectionClosedOnError(final Exception ex) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Log.error("Connection closed on error.", ex);
|
||||
|
||||
String message = "Your connection was closed due to an error.";
|
||||
|
||||
if (ex instanceof XMPPException) {
|
||||
XMPPException xmppEx = (XMPPException)ex;
|
||||
StreamError error = xmppEx.getStreamError();
|
||||
String reason = error.getCode();
|
||||
if ("conflict".equals(reason)) {
|
||||
message = "Your connection was closed due to the same user logging in from another location.";
|
||||
}
|
||||
}
|
||||
|
||||
Collection rooms = SparkManager.getChatManager().getChatContainer().getChatRooms();
|
||||
Iterator iter = rooms.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ChatRoom chatRoom = (ChatRoom)iter.next();
|
||||
chatRoom.getChatInputEditor().setEnabled(false);
|
||||
chatRoom.getSendButton().setEnabled(false);
|
||||
chatRoom.getTranscriptWindow().insertNotificationMessage(message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify agent that the connection has been closed.
|
||||
*/
|
||||
public void connectionClosed() {
|
||||
connectionClosedOnError(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the username associated with this session.
|
||||
*
|
||||
* @return the username associated with this session.
|
||||
*/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the password associated with this session.
|
||||
*
|
||||
* @return the password assoicated with this session.
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current availability of the user
|
||||
*
|
||||
* @param presence the current presence of the user.
|
||||
*/
|
||||
public void changePresence(Presence presence) {
|
||||
// Send Presence Packet
|
||||
SparkManager.getConnection().sendPacket(presence);
|
||||
|
||||
// Update Tray Icon
|
||||
SparkManager.getNotificationsEngine().changePresence(presence);
|
||||
|
||||
// Fire Presence Listeners
|
||||
final Iterator presenceListeners = new ArrayList(this.presenceListeners).iterator();
|
||||
while (presenceListeners.hasNext()) {
|
||||
((PresenceListener)presenceListeners.next()).presenceChanged(presence);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the jid of the Spark user.
|
||||
*
|
||||
* @return the jid of the Spark user.
|
||||
*/
|
||||
public String getJID() {
|
||||
return JID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the jid of the current Spark user.
|
||||
*
|
||||
* @param jid the jid of the current Spark user.
|
||||
*/
|
||||
public void setJID(String jid) {
|
||||
this.JID = jid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a <code>PresenceListener</code> to Spark. PresenceListener's are used
|
||||
* to allow notification of when the Spark users changes their presence.
|
||||
*
|
||||
* @param listener the listener.
|
||||
*/
|
||||
public void addPresenceListener(PresenceListener listener) {
|
||||
presenceListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a <code>PresenceListener</code> from Spark.
|
||||
*
|
||||
* @param listener the listener.
|
||||
*/
|
||||
public void removePresenceListener(PresenceListener listener) {
|
||||
presenceListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the users bare address. A bare-address is the address without a resource (ex. derek@jivesoftware.com/spark would
|
||||
* be derek@jivesoftware.com)
|
||||
*
|
||||
* @return the users bare address.
|
||||
*/
|
||||
public String getBareAddress() {
|
||||
return userBareAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Idle Timeout for this instance of Spark.
|
||||
*
|
||||
* @param mill the timeout value in milliseconds.
|
||||
*/
|
||||
private void setIdleListener(final long mill) {
|
||||
|
||||
final Timer timer = new Timer();
|
||||
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
public void run() {
|
||||
long idleTime = SystemInfo.getSessionIdleTime();
|
||||
boolean isLocked = SystemInfo.isSessionLocked();
|
||||
if (idleTime > mill) {
|
||||
try {
|
||||
// Handle if spark is not connected to the server.
|
||||
if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Change Status
|
||||
Workspace workspace = SparkManager.getWorkspace();
|
||||
Presence presence = workspace.getStatusBar().getPresence();
|
||||
if (workspace != null && presence.getMode() == Presence.Mode.AVAILABLE) {
|
||||
unavaliable = true;
|
||||
StatusItem away = workspace.getStatusBar().getStatusItem("Away");
|
||||
Presence p = away.getPresence();
|
||||
if (isLocked) {
|
||||
p.setStatus("User has locked their workstation.");
|
||||
}
|
||||
else {
|
||||
p.setStatus("Away due to idle.");
|
||||
}
|
||||
SparkManager.getSessionManager().changePresence(p);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("Error with IDLE status.", e);
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (unavaliable) {
|
||||
setAvailableIfActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
private void setAvailableIfActive() {
|
||||
|
||||
// Handle if spark is not connected to the server.
|
||||
if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Change Status
|
||||
Workspace workspace = SparkManager.getWorkspace();
|
||||
if (workspace != null) {
|
||||
Presence presence = workspace.getStatusBar().getStatusItem("Online").getPresence();
|
||||
SparkManager.getSessionManager().changePresence(presence);
|
||||
unavaliable = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Discovered Items.
|
||||
*
|
||||
* @return the discovered items found on startup.
|
||||
*/
|
||||
public DiscoverItems getDiscoveredItems() {
|
||||
return discoverItems;
|
||||
}
|
||||
|
||||
public void setConnection(XMPPConnection con) {
|
||||
this.connection = con;
|
||||
}
|
||||
|
||||
}
|
||||
134
src/java/org/jivesoftware/spark/SoundManager.java
Normal file
@ -0,0 +1,134 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.resource.SoundsRes;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.applet.AudioClip;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This manager is responsible for the playing, stopping and caching of sounds within Spark. You would
|
||||
* use this manager when you wish to play audio without adding too much memory overhead.
|
||||
*/
|
||||
public class SoundManager {
|
||||
|
||||
private final Map clipMap = new HashMap();
|
||||
private final Map fileMap = new HashMap();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public SoundManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays an audio clip of local clips deployed with Spark.
|
||||
*
|
||||
* @param clip the properties value found in la.properties.
|
||||
* @return the AudioClip found. If no audio clip was found, returns null.
|
||||
*/
|
||||
public AudioClip getClip(String clip) {
|
||||
if (!clipMap.containsKey(clip)) {
|
||||
// Add new clip
|
||||
final AudioClip newClip = loadClipForURL(clip);
|
||||
if (newClip != null) {
|
||||
clipMap.put(clip, newClip);
|
||||
}
|
||||
}
|
||||
|
||||
return (AudioClip)clipMap.get(clip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays an AudioClip.
|
||||
*
|
||||
* @param clip the audioclip to play.
|
||||
*/
|
||||
public void playClip(AudioClip clip) {
|
||||
try {
|
||||
clip.play();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.err.println("Unable to load sound file");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays an AudioClip.
|
||||
*
|
||||
* @param clipToPlay the properties value found in la.properties.
|
||||
*/
|
||||
public void playClip(String clipToPlay) {
|
||||
AudioClip clip = getClip(clipToPlay);
|
||||
try {
|
||||
clip.play();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.err.println("Unable to load sound file");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a sound file.
|
||||
*
|
||||
* @param soundFile the File object representing the wav file.
|
||||
*/
|
||||
public void playClip(final File soundFile) {
|
||||
Thread soundThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
final URL url = soundFile.toURL();
|
||||
AudioClip ac = (AudioClip)fileMap.get(url);
|
||||
if (ac == null) {
|
||||
ac = Applet.newAudioClip(url);
|
||||
fileMap.put(url, ac);
|
||||
}
|
||||
ac.play();
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
soundThread.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AudioClip from a URL.
|
||||
*
|
||||
* @param clipOfURL the url of the AudioClip to play. We only support .wav files at the moment.
|
||||
* @return the AudioFile found. If no audio file was found,returns null.
|
||||
*/
|
||||
private AudioClip loadClipForURL(String clipOfURL) {
|
||||
final URL url = SoundsRes.getURL(clipOfURL);
|
||||
AudioClip clip = null;
|
||||
|
||||
try {
|
||||
clip = Applet.newAudioClip(url);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("Unable to load sound url: " + url + "\n\t: " + e);
|
||||
}
|
||||
|
||||
return clip;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
344
src/java/org/jivesoftware/spark/SparkManager.java
Normal file
@ -0,0 +1,344 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smackx.MessageEventManager;
|
||||
import org.jivesoftware.spark.component.Notifications;
|
||||
import org.jivesoftware.spark.filetransfer.SparkTransferManager;
|
||||
import org.jivesoftware.spark.preference.PreferenceManager;
|
||||
import org.jivesoftware.spark.search.SearchManager;
|
||||
import org.jivesoftware.spark.ui.ChatPrinter;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.TranscriptWindow;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.profile.VCardManager;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* Used as the System Manager for the Spark IM client. The SparkManager is responsible for
|
||||
* the loading of other system managers on an as needed basis to prevent too much upfront loading
|
||||
* of resources. Some of the Managers and components you can access from here are:
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <h3>Managers</h3>
|
||||
* ChatManager - Used for adding, removing and appending listeners to Chat Rooms.
|
||||
* <br/>
|
||||
* PreferenceManager - Used for adding and removing Preferences.
|
||||
* <br/>
|
||||
* SoundManager - Used for playing sounds within Spark.
|
||||
* <br/>
|
||||
* SearchManager - Used for adding own search objects to Spark.
|
||||
* <br/>
|
||||
* SparkTransferManager - Used for all file transfer operations within Spark.
|
||||
* <br/>
|
||||
* ChatAssistantManager - Used to add ChatRoom plugins. ChatRoomPlugins are installed in their own pane on the
|
||||
* right side of the ChatRoom.
|
||||
* <br/>
|
||||
* VCardManager - Handles all profile handling within Spark. Use this to retrieve profile information on users.
|
||||
* <br/>
|
||||
* <h3>Windows and Components</h3>
|
||||
* <br/>
|
||||
* MainWindow - The frame containing the Spark client. Use for updating menus, and referencing parent frames.
|
||||
* <br/>
|
||||
* Workspace - The inner pane of the Spark client. Use for adding or removing tabs to the main Spark panel.
|
||||
* <br/>
|
||||
* Notifications - Use to display tray icon notifications (system specific), such as toaster popups or changing
|
||||
* the icon of the system tray.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
* @version 1.0, 03/12/14
|
||||
*/
|
||||
|
||||
|
||||
public final class SparkManager {
|
||||
|
||||
/**
|
||||
* The Date Formatter to use in Spark.
|
||||
*/
|
||||
public static final SimpleDateFormat DATE_SECOND_FORMATTER = new SimpleDateFormat("EEE MM/dd/yyyy h:mm:ss a");
|
||||
|
||||
private static SessionManager sessionManager;
|
||||
private static SoundManager soundManager;
|
||||
private static PreferenceManager preferenceManager;
|
||||
private static MessageEventManager messageEventManager;
|
||||
private static UserManager userManager;
|
||||
private static ChatManager chatManager;
|
||||
private static Notifications notifications;
|
||||
private static VCardManager vcardManager;
|
||||
private static AlertManager alertManager;
|
||||
|
||||
|
||||
private SparkManager() {
|
||||
// Do not allow initialization
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the {@link MainWindow} instance. The MainWindow is the frame container used
|
||||
* to hold the Workspace container and Menubar of the Spark Client.
|
||||
*
|
||||
* @return MainWindow instance.
|
||||
*/
|
||||
public static MainWindow getMainWindow() {
|
||||
return MainWindow.getInstance();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the {@link SessionManager} instance.
|
||||
*
|
||||
* @return the SessionManager instance.
|
||||
*/
|
||||
public static SessionManager getSessionManager() {
|
||||
if (sessionManager == null) {
|
||||
sessionManager = new SessionManager();
|
||||
}
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link SoundManager} instance.
|
||||
*
|
||||
* @return the SoundManager instance
|
||||
*/
|
||||
public static SoundManager getSoundManager() {
|
||||
if (soundManager == null) {
|
||||
soundManager = new SoundManager();
|
||||
}
|
||||
return soundManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link PreferenceManager} instance.
|
||||
*
|
||||
* @return the PreferenceManager instance.
|
||||
*/
|
||||
public static PreferenceManager getPreferenceManager() {
|
||||
if (preferenceManager == null) {
|
||||
preferenceManager = new PreferenceManager();
|
||||
}
|
||||
return preferenceManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link XMPPConnection} instance.
|
||||
*
|
||||
* @return the {@link XMPPConnection} associated with this session.
|
||||
*/
|
||||
public static XMPPConnection getConnection() {
|
||||
return sessionManager.getConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>UserManager</code> for LiveAssistant. The UserManager
|
||||
* keeps track of all users in current chats.
|
||||
*
|
||||
* @return the <code>UserManager</code> for LiveAssistant.
|
||||
*/
|
||||
public static UserManager getUserManager() {
|
||||
if (userManager == null) {
|
||||
userManager = new UserManager();
|
||||
}
|
||||
return userManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ChatManager. The ChatManager is responsible for creation and removal of
|
||||
* chat rooms, transcripts, and transfers and room invitations.
|
||||
*
|
||||
* @return the <code>ChatManager</code> for this instance.
|
||||
*/
|
||||
public static ChatManager getChatManager() {
|
||||
if (chatManager == null) {
|
||||
chatManager = new ChatManager();
|
||||
}
|
||||
return chatManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the inner container for Spark. The Workspace is the container for all plugins into the Spark
|
||||
* install. Plugins would use this for the following:
|
||||
* <p/>
|
||||
* <ul>
|
||||
* <li>Add own tab to the main tabbed pane. ex.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Workspace workspace = SparkManager.getWorkspace();
|
||||
* JButton button = new JButton("HELLO SPARK USERS");
|
||||
* workspace.getWorkspacePane().addTab("MyPlugin", button);
|
||||
* </p>
|
||||
* <p/>
|
||||
* <li>Retrieve the ContactList.
|
||||
*/
|
||||
public static Workspace getWorkspace() {
|
||||
return Workspace.getInstance();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Notification System to handle general notification in either
|
||||
* the system tray or "toaster" popups. You could use the notification engine
|
||||
* to alert users to incoming messages, new emails, or forum posts.
|
||||
*
|
||||
* @return the Notification system.
|
||||
*/
|
||||
public static Notifications getNotificationsEngine() {
|
||||
if (notifications == null) {
|
||||
notifications = new Notifications();
|
||||
}
|
||||
return notifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>MessageEventManager</code> used in Spark. The MessageEventManager is responsible
|
||||
* for XMPP specific operations such as notifying users that you have received their message or
|
||||
* inform a users that you are typing a message to them.
|
||||
*
|
||||
* @return the MessageEventManager used in Spark.
|
||||
*/
|
||||
public static MessageEventManager getMessageEventManager() {
|
||||
if (messageEventManager == null) {
|
||||
messageEventManager = new MessageEventManager(getConnection());
|
||||
}
|
||||
return messageEventManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the VCardManager. The VCardManager is responsible for handling all users profiles and updates
|
||||
* to their profiles. Use the VCardManager to access a users profile based on their Jabber User ID (JID).
|
||||
*
|
||||
* @return the VCardManager.
|
||||
*/
|
||||
public static VCardManager getVCardManager() {
|
||||
if (vcardManager == null) {
|
||||
vcardManager = new VCardManager();
|
||||
}
|
||||
return vcardManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AlertManager. The AlertManager allows for flashing of Windows within Spark.
|
||||
*
|
||||
* @return the AlertManager.
|
||||
*/
|
||||
public static AlertManager getAlertManager() {
|
||||
if (alertManager == null) {
|
||||
alertManager = new AlertManager();
|
||||
}
|
||||
|
||||
return alertManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints the transcript of a given chat room.
|
||||
*
|
||||
* @param room the chat room that contains the transcript to print.
|
||||
*/
|
||||
public static void printChatRoomTranscript(ChatRoom room) {
|
||||
final ChatPrinter printer = new ChatPrinter();
|
||||
final TranscriptWindow currentWindow = room.getTranscriptWindow();
|
||||
if (currentWindow != null) {
|
||||
printer.print(currentWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the String in the system clipboard. If not string is found,
|
||||
* null will be returned.
|
||||
*
|
||||
* @return the contents of the system clipboard. If none found, null is returned.
|
||||
*/
|
||||
public static String getClipboard() {
|
||||
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
|
||||
|
||||
try {
|
||||
if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
|
||||
return (String)t.getTransferData(DataFlavor.stringFlavor);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error("Could not retrieve info from clipboard.", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a string to the system clipboard.
|
||||
*
|
||||
* @param str the string to add the clipboard.
|
||||
*/
|
||||
public static void setClipboard(String str) {
|
||||
StringSelection ss = new StringSelection(str);
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a print dialog to print the transcript found in a <code>TranscriptWindow</code>
|
||||
*
|
||||
* @param transcriptWindow the <code>TranscriptWindow</code> containing the transcript.
|
||||
*/
|
||||
public static void printChatTranscript(TranscriptWindow transcriptWindow) {
|
||||
final ChatPrinter printer = new ChatPrinter();
|
||||
printer.print(transcriptWindow);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the <code>SparkTransferManager</code>. This is used
|
||||
* for any transfer operations within Spark. You may use the manager to
|
||||
* intercept file transfers for filtering of transfers or own plugin operations
|
||||
* with the File Transfer object.
|
||||
*
|
||||
* @return the SpartTransferManager.
|
||||
*/
|
||||
public static SparkTransferManager getTransferManager() {
|
||||
return SparkTransferManager.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>SearchManager</code>. This is used to allow
|
||||
* plugins to register their own search service.
|
||||
*
|
||||
* @return the SearchManager.
|
||||
*/
|
||||
public static SearchManager getSearchManager() {
|
||||
return SearchManager.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the User Directory to used by individual users. This allows for
|
||||
* Multi-User Support.
|
||||
*
|
||||
* @return the UserDirectory for Spark.
|
||||
*/
|
||||
public static File getUserDirectory() {
|
||||
final String bareJID = sessionManager.getBareAddress();
|
||||
File userDirectory = new File(Spark.getUserHome(), "Spark/user/" + bareJID);
|
||||
if (!userDirectory.exists()) {
|
||||
userDirectory.mkdirs();
|
||||
}
|
||||
return userDirectory;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
290
src/java/org/jivesoftware/spark/UserManager.java
Normal file
@ -0,0 +1,290 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smackx.muc.Occupant;
|
||||
import org.jivesoftware.smackx.packet.VCard;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.ContactItem;
|
||||
import org.jivesoftware.spark.ui.ContactList;
|
||||
import org.jivesoftware.spark.ui.rooms.GroupChatRoom;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.profile.VCardManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles all users in the agent application. Each user or chatting user can be referenced from the User
|
||||
* Manager. You would use the UserManager to get visitors in a chat room or secondary agents.
|
||||
*/
|
||||
public class UserManager {
|
||||
|
||||
public UserManager() {
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
final VCardManager vCardManager = SparkManager.getVCardManager();
|
||||
VCard vcard = vCardManager.getVCard();
|
||||
if (vcard == null) {
|
||||
return SparkManager.getSessionManager().getUsername();
|
||||
}
|
||||
else {
|
||||
String nickname = vcard.getNickName();
|
||||
if (ModelUtil.hasLength(nickname)) {
|
||||
return nickname;
|
||||
}
|
||||
else {
|
||||
String firstName = vcard.getFirstName();
|
||||
if (ModelUtil.hasLength(firstName)) {
|
||||
return firstName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default to node if nothing.
|
||||
return SparkManager.getSessionManager().getUsername();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a Collection of all user jids found in the specified room.
|
||||
*
|
||||
* @param room the name of the chatroom
|
||||
* @param fullJID set to true if you wish to have the full jid with resource, otherwise false
|
||||
* for the bare jid.
|
||||
* @return a Collection of jids found in the room.
|
||||
*/
|
||||
public Collection getUserJidsInRoom(String room, boolean fullJID) {
|
||||
final List returnList = new ArrayList();
|
||||
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the user is an owner of the specified room.
|
||||
*
|
||||
* @param groupChatRoom the group chat room.
|
||||
* @param nickname the user's nickname.
|
||||
* @return true if the user is an owner.
|
||||
*/
|
||||
public boolean isOwner(GroupChatRoom groupChatRoom, String nickname) {
|
||||
Occupant occupant = getOccupant(groupChatRoom, nickname);
|
||||
if (occupant != null) {
|
||||
String affiliation = occupant.getAffiliation();
|
||||
if ("owner".equals(affiliation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the Occupant is the owner of the room.
|
||||
*
|
||||
* @param occupant the occupant of a room.
|
||||
* @return true if the user is an owner.
|
||||
*/
|
||||
public boolean isOwner(Occupant occupant) {
|
||||
if (occupant != null) {
|
||||
String affiliation = occupant.getAffiliation();
|
||||
if ("owner".equals(affiliation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the Occupant is a moderator.
|
||||
*
|
||||
* @param groupChatRoom the group chat room.
|
||||
* @param nickname the nickname of the user.
|
||||
* @return true if the user is a moderator.
|
||||
*/
|
||||
public boolean isModerator(GroupChatRoom groupChatRoom, String nickname) {
|
||||
Occupant occupant = getOccupant(groupChatRoom, nickname);
|
||||
if (occupant != null) {
|
||||
String role = occupant.getRole();
|
||||
if ("moderator".equals(role)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the Occupant is a moderator.
|
||||
*
|
||||
* @param occupant the Occupant of a room.
|
||||
* @return true if the user is a moderator.
|
||||
*/
|
||||
public boolean isModerator(Occupant occupant) {
|
||||
if (occupant != null) {
|
||||
String role = occupant.getRole();
|
||||
if ("moderator".equals(role)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the user is either an owner or admin of a room.
|
||||
*
|
||||
* @param groupChatRoom the group chat room.
|
||||
* @param nickname the user's nickname.
|
||||
* @return true if the user is either an owner or admin of the room.
|
||||
*/
|
||||
public boolean isOwnerOrAdmin(GroupChatRoom groupChatRoom, String nickname) {
|
||||
Occupant occupant = getOccupant(groupChatRoom, nickname);
|
||||
if (occupant != null) {
|
||||
String affiliation = occupant.getAffiliation();
|
||||
if ("owner".equals(affiliation) || "admin".equals(affiliation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the user is either an owner or admin of the given room.
|
||||
*
|
||||
* @param occupant the <code>Occupant</code> to check.
|
||||
* @return true if the user is either an owner or admin of the room.
|
||||
*/
|
||||
public boolean isOwnerOrAdmin(Occupant occupant) {
|
||||
if (occupant != null) {
|
||||
String affiliation = occupant.getAffiliation();
|
||||
if ("owner".equals(affiliation) || "admin".equals(affiliation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the occupant of the room identified by their nickname.
|
||||
*
|
||||
* @param groupChatRoom the GroupChatRoom.
|
||||
* @param nickname the users nickname.
|
||||
* @return the Occupant found.
|
||||
*/
|
||||
public Occupant getOccupant(GroupChatRoom groupChatRoom, String nickname) {
|
||||
String userJID = groupChatRoom.getRoomname() + "/" + nickname;
|
||||
Occupant occ = null;
|
||||
try {
|
||||
occ = groupChatRoom.getMultiUserChat().getOccupant(userJID);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
return occ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the nickname of a user in a room and determines if they are an
|
||||
* administrator of the room.
|
||||
*
|
||||
* @param groupChatRoom the GroupChatRoom.
|
||||
* @param nickname the nickname of the user. Note: In MultiUserChats, users nicknames
|
||||
* are defined by the resource(ex.theroom@conference.jivesoftware.com/derek) would have
|
||||
* derek as a nickname.
|
||||
* @return true if the user is an admin.
|
||||
*/
|
||||
public boolean isAdmin(GroupChatRoom groupChatRoom, String nickname) {
|
||||
Occupant occupant = getOccupant(groupChatRoom, nickname);
|
||||
if (occupant != null) {
|
||||
String affiliation = occupant.getAffiliation();
|
||||
if ("admin".equals(affiliation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasVoice(GroupChatRoom groupChatRoom, String nickname) {
|
||||
Occupant occupant = getOccupant(groupChatRoom, nickname);
|
||||
if (occupant != null) {
|
||||
String role = occupant.getRole();
|
||||
if ("visitor".equals(role)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Collection of all <code>ChatUsers</code> in a ChatRoom.
|
||||
*
|
||||
* @param chatRoom the ChatRoom to inspect.
|
||||
* @return the Collection of all ChatUsers.
|
||||
* @see <code>ChatUser</code>
|
||||
*/
|
||||
public Collection getAllParticipantsInRoom(ChatRoom chatRoom) {
|
||||
final String room = chatRoom.getRoomname();
|
||||
final List returnList = new ArrayList();
|
||||
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
|
||||
public String getUserNicknameFromJID(String jid) {
|
||||
ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||
ContactItem item = contactList.getContactItemByJID(jid);
|
||||
if (item != null) {
|
||||
return item.getNickname();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full jid w/ resource of a user by their nickname
|
||||
* in the ContactList.
|
||||
*
|
||||
* @param nickname the nickname of the user.
|
||||
* @return the full jid w/ resource of the user.
|
||||
*/
|
||||
public String getJIDFromNickname(String nickname) {
|
||||
ContactList contactList = SparkManager.getWorkspace().getContactList();
|
||||
ContactItem item = contactList.getContactItemByNickname(nickname);
|
||||
if (item != null) {
|
||||
return getFullJID(item.getFullJID());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full jid (with resource) based on the user's jid.
|
||||
*
|
||||
* @param jid the users bare jid.
|
||||
* @return the full jid with resource.
|
||||
*/
|
||||
public String getFullJID(String jid) {
|
||||
Roster roster = SparkManager.getConnection().getRoster();
|
||||
Presence presence = roster.getPresence(jid);
|
||||
if (presence != null) {
|
||||
return presence.getFrom();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
408
src/java/org/jivesoftware/spark/Workspace.java
Normal file
@ -0,0 +1,408 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark;
|
||||
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.MainWindowListener;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.smackx.packet.DelayInformation;
|
||||
import org.jivesoftware.spark.filetransfer.SparkTransferManager;
|
||||
import org.jivesoftware.spark.search.SearchManager;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
||||
import org.jivesoftware.spark.ui.ContactItem;
|
||||
import org.jivesoftware.spark.ui.ContactList;
|
||||
import org.jivesoftware.spark.ui.conferences.Conferences;
|
||||
import org.jivesoftware.spark.ui.status.StatusBar;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.plugin.manager.Enterprise;
|
||||
import org.jivesoftware.sparkimpl.plugin.transcripts.ChatTranscriptPlugin;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
/**
|
||||
* The inner Container for Spark. The Workspace is the container for all plugins into the Spark
|
||||
* install. Plugins would use this for the following:
|
||||
* <p/>
|
||||
* <ul>
|
||||
* <li>Add own tab to the main tabbed pane. ex.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Workspace workspace = SparkManager.getWorkspace();
|
||||
* JButton button = new JButton("HELLO SPARK USERS");
|
||||
* workspace.getWorkspacePane().addTab("MyPlugin", button);
|
||||
* </p>
|
||||
* <p/>
|
||||
* <li>Retrieve the ContactList.
|
||||
*/
|
||||
public class Workspace extends JPanel implements PacketListener {
|
||||
private JTabbedPane workspacePane;
|
||||
private final StatusBar statusBox = new StatusBar();
|
||||
private ContactList contactList;
|
||||
private Conferences conferences;
|
||||
|
||||
private static Workspace singleton;
|
||||
private static final Object LOCK = new Object();
|
||||
private List offlineMessages = new ArrayList();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the singleton instance of <CODE>Workspace</CODE>,
|
||||
* creating it if necessary.
|
||||
* <p/>
|
||||
*
|
||||
* @return the singleton instance of <Code>Workspace</CODE>
|
||||
*/
|
||||
public static Workspace getInstance() {
|
||||
// Synchronize on LOCK to ensure that we don't end up creating
|
||||
// two singletons.
|
||||
synchronized (LOCK) {
|
||||
if (null == singleton) {
|
||||
Workspace controller = new Workspace();
|
||||
singleton = controller;
|
||||
return controller;
|
||||
}
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the instance of the SupportChatWorkspace.
|
||||
*/
|
||||
private Workspace() {
|
||||
MainWindow mainWindow = SparkManager.getMainWindow();
|
||||
|
||||
// Add MainWindow listener
|
||||
mainWindow.addMainWindowListener(new MainWindowListener() {
|
||||
public void shutdown() {
|
||||
// Close all Chats.
|
||||
final Iterator chatRooms = SparkManager.getChatManager().getChatContainer().getAllChatRooms();
|
||||
while (chatRooms.hasNext()) {
|
||||
final ChatRoom chatRoom = (ChatRoom)chatRooms.next();
|
||||
|
||||
// Leave ChatRoom
|
||||
SparkManager.getChatManager().getChatContainer().leaveChatRoom(chatRoom);
|
||||
}
|
||||
|
||||
conferences.shutdown();
|
||||
}
|
||||
|
||||
public void mainWindowActivated() {
|
||||
|
||||
}
|
||||
|
||||
public void mainWindowDeactivated() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize workspace pane, defaulting the tabs to the bottom.
|
||||
workspacePane = new JTabbedPane(JTabbedPane.BOTTOM);
|
||||
//workspacePane.setBoldActiveTab(true);
|
||||
//workspacePane.setHideOneTab(true);
|
||||
|
||||
// Build default workspace
|
||||
this.setLayout(new GridBagLayout());
|
||||
add(workspacePane, new GridBagConstraints(0, 9, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
|
||||
add(statusBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
|
||||
|
||||
|
||||
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F12"), "showDebugger");
|
||||
this.getActionMap().put("showDebugger", new AbstractAction("showDebugger") {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
EnhancedDebuggerWindow window = EnhancedDebuggerWindow.getInstance();
|
||||
window.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
// Set background
|
||||
Color menuBarColor = new Color(235, 233, 237);
|
||||
setBackground(menuBarColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Workspace layout.
|
||||
*/
|
||||
public void buildLayout() {
|
||||
new Enterprise();
|
||||
|
||||
// Initilaize tray
|
||||
SparkManager.getNotificationsEngine();
|
||||
|
||||
// Initialize Contact List
|
||||
contactList = new ContactList();
|
||||
contactList.initialize();
|
||||
|
||||
conferences = new Conferences();
|
||||
conferences.initialize();
|
||||
|
||||
// Initialize Search Service
|
||||
SearchManager.getInstance();
|
||||
|
||||
// Initialise TransferManager
|
||||
SparkTransferManager.getInstance();
|
||||
|
||||
ChatTranscriptPlugin transcriptPlugin = new ChatTranscriptPlugin();
|
||||
transcriptPlugin.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the Loading of all Spark Plugins.
|
||||
*/
|
||||
public void loadPlugins() {
|
||||
// Add presence and message listeners
|
||||
// we listen for these to force open a 1-1 peer chat window from other operators if
|
||||
// one isn't already open
|
||||
PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class);
|
||||
|
||||
// Add the packetListener to this instance
|
||||
SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter);
|
||||
|
||||
// Make presence available to anonymous requests, if from anonymous user in the system.
|
||||
PacketListener workspacePresenceListener = new PacketListener() {
|
||||
public void processPacket(Packet packet) {
|
||||
Presence presence = (Presence)packet;
|
||||
if (presence != null && presence.getProperty("anonymous") != null) {
|
||||
boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.AVAILABLE;
|
||||
Presence reply = new Presence(Presence.Type.AVAILABLE);
|
||||
if (!isAvailable) {
|
||||
reply.setType(Presence.Type.UNAVAILABLE);
|
||||
}
|
||||
reply.setTo(presence.getFrom());
|
||||
SparkManager.getSessionManager().getConnection().sendPacket(reply);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class));
|
||||
|
||||
// Send Available status
|
||||
final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence();
|
||||
SparkManager.getSessionManager().changePresence(presence);
|
||||
|
||||
// Load Plugins
|
||||
SwingWorker worker = new SwingWorker() {
|
||||
public Object construct() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Log.error("Unable to sleep thread.", e);
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public void finished() {
|
||||
final PluginManager pluginManager = PluginManager.getInstance();
|
||||
pluginManager.loadPlugins();
|
||||
pluginManager.initializePlugins();
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
|
||||
|
||||
int numberOfMillisecondsInTheFuture = 5000; // 5 sec
|
||||
Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture);
|
||||
Timer timer = new Timer();
|
||||
|
||||
timer.schedule(new TimerTask() {
|
||||
public void run() {
|
||||
final Iterator offlineMessage = offlineMessages.iterator();
|
||||
while (offlineMessage.hasNext()) {
|
||||
Message offline = (Message)offlineMessage.next();
|
||||
handleOfflineMessage(offline);
|
||||
}
|
||||
}
|
||||
}, timeToRun);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the status box for the User.
|
||||
*
|
||||
* @return the status box for the user.
|
||||
*/
|
||||
public StatusBar getStatusBar() {
|
||||
return statusBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to handle agent to agent conversations.
|
||||
*
|
||||
* @param packet the smack packet to process.
|
||||
*/
|
||||
public void processPacket(final Packet packet) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
handleIncomingPacket(packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void handleIncomingPacket(Packet packet) {
|
||||
// We only handle message packets here.
|
||||
if (packet instanceof Message) {
|
||||
final Message message = (Message)packet;
|
||||
boolean isGroupChat = message.getType() == Message.Type.GROUP_CHAT;
|
||||
|
||||
// Check if Conference invite. If so, do not handle here.
|
||||
if (message.getExtension("x", "jabber:x:conference") != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String body = message.getBody();
|
||||
boolean broadcast = message.getProperty("broadcast") != null;
|
||||
|
||||
if (body == null || isGroupChat || broadcast || message.getType() == Message.Type.NORMAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new chat room for Agent Invite.
|
||||
final String from = packet.getFrom();
|
||||
final String host = SparkManager.getSessionManager().getServerAddress();
|
||||
|
||||
// Don't allow workgroup notifications to come through here.
|
||||
final String bareJID = StringUtils.parseBareAddress(from);
|
||||
if (host.equalsIgnoreCase(from) || from == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ChatRoom room = null;
|
||||
try {
|
||||
room = SparkManager.getChatManager().getChatContainer().getChatRoom(bareJID);
|
||||
}
|
||||
catch (ChatRoomNotFoundException e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
// Handle offline message.
|
||||
DelayInformation offlineInformation = (DelayInformation)message.getExtension("x", "jabber:x:delay");
|
||||
|
||||
if (offlineInformation != null && (Message.Type.CHAT == message.getType() || Message.Type.NORMAL == message.getType())) {
|
||||
offlineMessages.add(message);
|
||||
}
|
||||
|
||||
// Check for anonymous user.
|
||||
else if (room == null) {
|
||||
createOneToOneRoom(bareJID, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new room if necessary and inserts an offline message.
|
||||
*
|
||||
* @param message The Offline message.
|
||||
*/
|
||||
private void handleOfflineMessage(Message message) {
|
||||
DelayInformation offlineInformation = (DelayInformation)message.getExtension("x", "jabber:x:delay");
|
||||
String bareJID = StringUtils.parseBareAddress(message.getFrom());
|
||||
ContactItem contact = contactList.getContactItemByJID(bareJID);
|
||||
String nickname = StringUtils.parseName(bareJID);
|
||||
if (contact != null) {
|
||||
nickname = contact.getNickname();
|
||||
}
|
||||
|
||||
// Create the room if it does not exist.
|
||||
ChatRoom room = SparkManager.getChatManager().createChatRoom(bareJID, nickname, nickname);
|
||||
|
||||
// Insert offline message
|
||||
String offlineMessage = "(Offline) " + message.getBody();
|
||||
room.getTranscriptWindow().insertOthersMessage(nickname, offlineMessage, offlineInformation.getStamp());
|
||||
room.addToTranscript(message, true);
|
||||
|
||||
// Send display and notified message back.
|
||||
SparkManager.getMessageEventManager().sendDeliveredNotification(message.getFrom(), message.getPacketID());
|
||||
SparkManager.getMessageEventManager().sendDisplayedNotification(message.getFrom(), message.getPacketID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new room based on an anonymous user.
|
||||
*
|
||||
* @param bareJID the bareJID of the anonymous user.
|
||||
* @param message the message from the anonymous user.
|
||||
*/
|
||||
private void createOneToOneRoom(String bareJID, Message message) {
|
||||
ContactItem contact = contactList.getContactItemByJID(bareJID);
|
||||
String nickname = StringUtils.parseName(bareJID);
|
||||
if (contact != null) {
|
||||
nickname = contact.getNickname();
|
||||
}
|
||||
|
||||
SparkManager.getChatManager().createChatRoom(bareJID, nickname, nickname);
|
||||
try {
|
||||
insertMessage(bareJID, message);
|
||||
}
|
||||
catch (ChatRoomNotFoundException e) {
|
||||
Log.error("Could not find chat room.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void insertMessage(final String bareJID, final Message message) throws ChatRoomNotFoundException {
|
||||
ChatRoom chatRoom = SparkManager.getChatManager().getChatContainer().getChatRoom(bareJID);
|
||||
chatRoom.insertMessage(message);
|
||||
int chatLength = chatRoom.getTranscriptWindow().getDocument().getLength();
|
||||
chatRoom.getTranscriptWindow().setCaretPosition(chatLength);
|
||||
chatRoom.getChatInputEditor().requestFocusInWindow();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Workspace TabbedPane. If you wish to add your
|
||||
* component, simply use addTab( name, icon, component ) call.
|
||||
*
|
||||
* @return the workspace JideTabbedPane
|
||||
*/
|
||||
public JTabbedPane getWorkspacePane() {
|
||||
return workspacePane;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the <code>ContactList</code> associated with this workspace.
|
||||
*
|
||||
* @return the ContactList associated with this workspace.
|
||||
*/
|
||||
public ContactList getContactList() {
|
||||
return contactList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jivesoftware.resource.Default;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
/**
|
||||
* An implementation of a colored background panel. Allows implementations
|
||||
* to specify an image to use in the background of the panel.
|
||||
*/
|
||||
public class BackgroundPanel extends JPanel {
|
||||
|
||||
/**
|
||||
* Creates a background panel using the default Spark background image.
|
||||
*/
|
||||
public BackgroundPanel() {
|
||||
}
|
||||
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
final Image backgroundImage = Default.getImageIcon(Default.SECONDARY_BACKGROUND_IMAGE).getImage();
|
||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||
}
|
||||
}
|
||||
68
src/java/org/jivesoftware/spark/component/CheckBoxList.java
Normal file
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Constructs a selection list with Checkboxes.
|
||||
*/
|
||||
public class CheckBoxList extends JPanel {
|
||||
private Map valueMap = new HashMap();
|
||||
private JPanel internalPanel = new JPanel();
|
||||
|
||||
/**
|
||||
* Create the CheckBoxList UI.
|
||||
*/
|
||||
public CheckBoxList() {
|
||||
setLayout(new BorderLayout());
|
||||
internalPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 5, 5, true, false));
|
||||
add(new JScrollPane(internalPanel), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a checkbox with an associated value.
|
||||
*
|
||||
* @param box the checkbox.
|
||||
* @param value the value bound to the checkbox.
|
||||
*/
|
||||
public void addCheckBox(JCheckBox box, String value) {
|
||||
internalPanel.add(box);
|
||||
valueMap.put(box, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of selected checkbox values.
|
||||
*
|
||||
* @return list of selected checkbox values.
|
||||
*/
|
||||
public List getSelectedValues() {
|
||||
List list = new ArrayList();
|
||||
Iterator iter = valueMap.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
JCheckBox checkbox = (JCheckBox)iter.next();
|
||||
if (checkbox.isSelected()) {
|
||||
String value = (String)valueMap.get(checkbox);
|
||||
list.add(value);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
151
src/java/org/jivesoftware/spark/component/CheckNode.java
Normal file
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Creates one tree node with a check box.
|
||||
*/
|
||||
public class CheckNode extends JiveTreeNode {
|
||||
/**
|
||||
* Mode to use if the node should not expand when selected.
|
||||
*/
|
||||
public static final int SINGLE_SELECTION = 0;
|
||||
|
||||
/**
|
||||
* Mode to use if the node should be expaned if selected and if possible.
|
||||
*/
|
||||
public static final int DIG_IN_SELECTION = 4;
|
||||
|
||||
private int selectionMode;
|
||||
private boolean isSelected;
|
||||
private String fullName;
|
||||
private Object associatedObject;
|
||||
|
||||
/**
|
||||
* Construct an empty node.
|
||||
*/
|
||||
public CheckNode() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new CheckNode with the specified name.
|
||||
*
|
||||
* @param userObject the name to use.
|
||||
*/
|
||||
public CheckNode(Object userObject) {
|
||||
this(userObject, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new CheckNode.
|
||||
*
|
||||
* @param userObject the name to use.
|
||||
* @param allowsChildren true if it allows children.
|
||||
* @param isSelected true if it is to be selected.
|
||||
*/
|
||||
public CheckNode(Object userObject, boolean allowsChildren, boolean isSelected) {
|
||||
super(userObject, allowsChildren);
|
||||
this.isSelected = isSelected;
|
||||
setSelectionMode(DIG_IN_SELECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new CheckNode.
|
||||
*
|
||||
* @param userObject the name to use.
|
||||
* @param allowsChildren true if it allows children.
|
||||
* @param isSelected true if it is selected.
|
||||
* @param name the identifier name.
|
||||
*/
|
||||
public CheckNode(Object userObject, boolean allowsChildren, boolean isSelected, String name) {
|
||||
super(userObject, allowsChildren);
|
||||
this.isSelected = isSelected;
|
||||
setSelectionMode(DIG_IN_SELECTION);
|
||||
fullName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full name of the node.
|
||||
*
|
||||
* @return the full name of the node.
|
||||
*/
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection mode.
|
||||
*
|
||||
* @param mode the selection mode to use.
|
||||
*/
|
||||
public void setSelectionMode(int mode) {
|
||||
selectionMode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the selection mode.
|
||||
*
|
||||
* @return the selection mode.
|
||||
*/
|
||||
public int getSelectionMode() {
|
||||
return selectionMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects or deselects node.
|
||||
*
|
||||
* @param isSelected true if the node should be selected, false otherwise.
|
||||
*/
|
||||
public void setSelected(boolean isSelected) {
|
||||
this.isSelected = isSelected;
|
||||
|
||||
if (selectionMode == DIG_IN_SELECTION
|
||||
&& children != null) {
|
||||
Enumeration nodeEnum = children.elements();
|
||||
while (nodeEnum.hasMoreElements()) {
|
||||
CheckNode node = (CheckNode)nodeEnum.nextElement();
|
||||
node.setSelected(isSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the node is selected.
|
||||
*
|
||||
* @return true if the node is selected.
|
||||
*/
|
||||
public boolean isSelected() {
|
||||
return isSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associated object of this node.
|
||||
*
|
||||
* @return the associated object.
|
||||
*/
|
||||
public Object getAssociatedObject() {
|
||||
return associatedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an assoicated object for this node.
|
||||
*
|
||||
* @param associatedObject the associated object set.
|
||||
*/
|
||||
public void setAssociatedObject(Object associatedObject) {
|
||||
this.associatedObject = associatedObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
173
src/java/org/jivesoftware/spark/component/CheckRenderer.java
Normal file
@ -0,0 +1,173 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
|
||||
/**
|
||||
* Swing Renderer for <code>CheckNode</code>.
|
||||
*/
|
||||
public class CheckRenderer extends JPanel implements TreeCellRenderer {
|
||||
private JCheckBox check;
|
||||
private TreeLabel label;
|
||||
|
||||
/**
|
||||
* Create new CheckRenderer.
|
||||
*/
|
||||
public CheckRenderer() {
|
||||
setLayout(null);
|
||||
add(check = new JCheckBox());
|
||||
add(label = new TreeLabel());
|
||||
check.setBackground(UIManager.getColor("Tree.textBackground"));
|
||||
label.setForeground(UIManager.getColor("Tree.textForeground"));
|
||||
}
|
||||
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value,
|
||||
boolean isSelected, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus) {
|
||||
String stringValue = tree.convertValueToText(value, isSelected,
|
||||
expanded, leaf, row, hasFocus);
|
||||
setEnabled(tree.isEnabled());
|
||||
check.setSelected(((CheckNode)value).isSelected());
|
||||
label.setFont(tree.getFont());
|
||||
label.setText(stringValue);
|
||||
label.setSelected(isSelected);
|
||||
label.setFocus(hasFocus);
|
||||
if (leaf) {
|
||||
label.setIcon(UIManager.getIcon("Tree.leafIcon"));
|
||||
}
|
||||
else if (expanded) {
|
||||
label.setIcon(UIManager.getIcon("Tree.openIcon"));
|
||||
}
|
||||
else {
|
||||
label.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension d_check = new Dimension(30, 30);//check.getPreferredSize();
|
||||
Dimension d_label = label.getPreferredSize();
|
||||
return new Dimension(d_check.width + d_label.width,
|
||||
d_check.height < d_label.height ? d_label.height : d_check.height);
|
||||
}
|
||||
|
||||
public void doLayout() {
|
||||
Dimension d_check = check.getPreferredSize();
|
||||
Dimension d_label = label.getPreferredSize();
|
||||
int y_check = 0;
|
||||
int y_label = 0;
|
||||
if (d_check.height < d_label.height) {
|
||||
y_check = (d_label.height - d_check.height) / 2;
|
||||
}
|
||||
else {
|
||||
y_label = (d_check.height - d_label.height) / 2;
|
||||
}
|
||||
check.setLocation(0, y_check);
|
||||
check.setBounds(0, y_check, d_check.width, d_check.height);
|
||||
label.setLocation(d_check.width, y_label);
|
||||
label.setBounds(d_check.width, y_label, d_label.width, d_label.height);
|
||||
}
|
||||
|
||||
|
||||
public void setBackground(Color color) {
|
||||
if (color instanceof ColorUIResource)
|
||||
color = null;
|
||||
super.setBackground(color);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents one UI node for the checkbox node.
|
||||
*/
|
||||
public class TreeLabel extends JLabel {
|
||||
boolean isSelected;
|
||||
boolean hasFocus;
|
||||
|
||||
/**
|
||||
* Empty Constructor.
|
||||
*/
|
||||
public TreeLabel() {
|
||||
}
|
||||
|
||||
public void setBackground(Color color) {
|
||||
if (color instanceof ColorUIResource)
|
||||
color = null;
|
||||
super.setBackground(color);
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
String str;
|
||||
if ((str = getText()) != null) {
|
||||
if (0 < str.length()) {
|
||||
if (isSelected) {
|
||||
g.setColor(UIManager.getColor("Tree.selectionBackground"));
|
||||
}
|
||||
else {
|
||||
g.setColor(UIManager.getColor("Tree.textBackground"));
|
||||
}
|
||||
Dimension d = getPreferredSize();
|
||||
int imageOffset = 0;
|
||||
Icon currentI = getIcon();
|
||||
if (currentI != null) {
|
||||
imageOffset = currentI.getIconWidth() + Math.max(0, getIconTextGap() - 1);
|
||||
}
|
||||
g.fillRect(imageOffset, 0, d.width - 1 - imageOffset, d.height);
|
||||
if (hasFocus) {
|
||||
g.setColor(UIManager.getColor("Tree.selectionBorderColor"));
|
||||
g.drawRect(imageOffset, 0, d.width - 1 - imageOffset, d.height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension retDimension = super.getPreferredSize();
|
||||
if (retDimension != null) {
|
||||
retDimension = new Dimension(retDimension.width + 3,
|
||||
retDimension.height);
|
||||
}
|
||||
return retDimension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true to select the node.
|
||||
*
|
||||
* @param isSelected true if the node should be selected.
|
||||
*/
|
||||
public void setSelected(boolean isSelected) {
|
||||
this.isSelected = isSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets focus on the node.
|
||||
*
|
||||
* @param hasFocus true if the node has focus.
|
||||
*/
|
||||
public void setFocus(boolean hasFocus) {
|
||||
this.hasFocus = hasFocus;
|
||||
}
|
||||
}
|
||||
}
|
||||
132
src/java/org/jivesoftware/spark/component/CheckTree.java
Normal file
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* UI to show CheckBox trees.
|
||||
*/
|
||||
public class CheckTree extends JPanel {
|
||||
private JTree tree;
|
||||
private CheckNode rootNode;
|
||||
|
||||
/**
|
||||
* Constructs a new CheckBox tree.
|
||||
*/
|
||||
public CheckTree(CheckNode rootNode) {
|
||||
this.rootNode = rootNode;
|
||||
|
||||
tree = new JTree(rootNode);
|
||||
tree.setCellRenderer(new CheckRenderer());
|
||||
tree.setRowHeight(18);
|
||||
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
||||
tree.setToggleClickCount(1000);
|
||||
tree.putClientProperty("JTree.lineStyle", "Angled");
|
||||
tree.addMouseListener(new NodeSelectionListener(tree));
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
add(tree, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
class NodeSelectionListener extends MouseAdapter {
|
||||
JTree tree;
|
||||
|
||||
NodeSelectionListener(JTree tree) {
|
||||
this.tree = tree;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
int row = tree.getRowForLocation(x, y);
|
||||
TreePath path = tree.getPathForRow(row);
|
||||
if (path != null) {
|
||||
CheckNode node = (CheckNode)path.getLastPathComponent();
|
||||
boolean isSelected = !node.isSelected();
|
||||
node.setSelected(isSelected);
|
||||
if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
|
||||
if (isSelected) {
|
||||
//tree.expandPath(path);
|
||||
}
|
||||
else {
|
||||
//tree.collapsePath(path);
|
||||
}
|
||||
}
|
||||
((DefaultTreeModel)tree.getModel()).nodeChanged(node);
|
||||
// I need revalidate if node is root. but why?
|
||||
if (row == 0) {
|
||||
tree.revalidate();
|
||||
tree.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the CheckTree.
|
||||
*/
|
||||
public void close() {
|
||||
final Enumeration nodeEnum = rootNode.breadthFirstEnumeration();
|
||||
while (nodeEnum.hasMoreElements()) {
|
||||
CheckNode node = (CheckNode)nodeEnum.nextElement();
|
||||
if (node.isSelected()) {
|
||||
String fullname = node.getFullName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ButtonActionListener implements ActionListener {
|
||||
CheckNode root;
|
||||
JTextArea textArea;
|
||||
|
||||
ButtonActionListener(CheckNode root, JTextArea textArea) {
|
||||
this.root = root;
|
||||
this.textArea = textArea;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Enumeration nodeEnum = root.breadthFirstEnumeration();
|
||||
while (nodeEnum.hasMoreElements()) {
|
||||
CheckNode node = (CheckNode)nodeEnum.nextElement();
|
||||
if (node.isSelected()) {
|
||||
TreeNode[] nodes = node.getPath();
|
||||
textArea.append("\n" + nodes[0].toString());
|
||||
for (int i = 1; i < nodes.length; i++) {
|
||||
textArea.append("/" + nodes[i].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JTree getTree() {
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
141
src/java/org/jivesoftware/spark/component/ConfirmDialog.java
Normal file
@ -0,0 +1,141 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
/**
|
||||
* Implementation of a Confirm Dialog to replace the modal JOptionPane.confirm. This is intended
|
||||
* for use as a yes - no dialog.
|
||||
*/
|
||||
public class ConfirmDialog extends BackgroundPanel {
|
||||
private JLabel message;
|
||||
private JLabel iconLabel;
|
||||
private JButton yesButton;
|
||||
private JButton noButton;
|
||||
|
||||
private ConfirmListener listener = null;
|
||||
private JDialog dialog;
|
||||
|
||||
/**
|
||||
* Creates the base confirm Dialog.
|
||||
*/
|
||||
public ConfirmDialog() {
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
message = new JLabel();
|
||||
iconLabel = new JLabel();
|
||||
yesButton = new JButton();
|
||||
noButton = new JButton();
|
||||
|
||||
add(iconLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(message, new GridBagConstraints(1, 0, 4, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(yesButton, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(noButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
yesButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (listener != null) {
|
||||
listener.yesOption();
|
||||
}
|
||||
dialog.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
noButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
dialog.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and displays the new confirm dialog.
|
||||
*
|
||||
* @param parent the parent dialog.
|
||||
* @param title the title of this dialog.
|
||||
* @param text the main text to display.
|
||||
* @param yesText the text to use on the OK or Yes button.
|
||||
* @param noText the text to use on the No button.
|
||||
* @param icon the icon to use for graphical represenation.
|
||||
*/
|
||||
public void showConfirmDialog(JFrame parent, String title, String text, String yesText, String noText, Icon icon) {
|
||||
message.setText("<html><body>" + text + "</body></html>");
|
||||
iconLabel.setIcon(icon);
|
||||
|
||||
ResourceUtils.resButton(yesButton, yesText);
|
||||
ResourceUtils.resButton(noButton, noText);
|
||||
|
||||
dialog = new JDialog(parent, title, false);
|
||||
dialog.getContentPane().setLayout(new BorderLayout());
|
||||
dialog.getContentPane().add(this);
|
||||
dialog.pack();
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
dialog.setVisible(true);
|
||||
|
||||
dialog.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosed(WindowEvent windowEvent) {
|
||||
if (listener != null) {
|
||||
listener.noOption();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setDialogSize(int width, int height) {
|
||||
dialog.setSize(width, height);
|
||||
dialog.pack();
|
||||
dialog.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ConfirmListener to use with this dialog instance.
|
||||
*
|
||||
* @param listener the <code>ConfirmListener</code> to use with this instance.
|
||||
*/
|
||||
public void setConfirmListener(ConfirmListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to handle yes/no selection in dialog. You would use this simply to
|
||||
* be notified when a user has either clicked on the yes or no dialog.
|
||||
*/
|
||||
public interface ConfirmListener {
|
||||
|
||||
/**
|
||||
* Fired when the Yes button has been clicked.
|
||||
*/
|
||||
void yesOption();
|
||||
|
||||
/**
|
||||
* Fired when the No button has been clicked.
|
||||
*/
|
||||
void noOption();
|
||||
}
|
||||
}
|
||||
126
src/java/org/jivesoftware/spark/component/DroppableFrame.java
Normal file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.dnd.DnDConstants;
|
||||
import java.awt.dnd.DragGestureEvent;
|
||||
import java.awt.dnd.DragGestureListener;
|
||||
import java.awt.dnd.DragSource;
|
||||
import java.awt.dnd.DragSourceDragEvent;
|
||||
import java.awt.dnd.DragSourceDropEvent;
|
||||
import java.awt.dnd.DragSourceEvent;
|
||||
import java.awt.dnd.DragSourceListener;
|
||||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.dnd.DropTargetDragEvent;
|
||||
import java.awt.dnd.DropTargetDropEvent;
|
||||
import java.awt.dnd.DropTargetEvent;
|
||||
import java.awt.dnd.DropTargetListener;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a DroppableFrame. A droppable frame allows for DnD of file objects from the OS
|
||||
* onto the actual frame via <code>File</code> object.
|
||||
*/
|
||||
public abstract class DroppableFrame extends JFrame implements DropTargetListener, DragSourceListener, DragGestureListener {
|
||||
private DropTarget dropTarget = new DropTarget(this, this);
|
||||
private DragSource dragSource = DragSource.getDefaultDragSource();
|
||||
|
||||
/**
|
||||
* Creates an Instance of the Droppable Frame.
|
||||
*/
|
||||
protected DroppableFrame() {
|
||||
dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this);
|
||||
}
|
||||
|
||||
public void dragDropEnd(DragSourceDropEvent DragSourceDropEvent) {
|
||||
}
|
||||
|
||||
public void dragEnter(DragSourceDragEvent DragSourceDragEvent) {
|
||||
}
|
||||
|
||||
public void dragExit(DragSourceEvent DragSourceEvent) {
|
||||
}
|
||||
|
||||
public void dragOver(DragSourceDragEvent DragSourceDragEvent) {
|
||||
}
|
||||
|
||||
public void dropActionChanged(DragSourceDragEvent DragSourceDragEvent) {
|
||||
}
|
||||
|
||||
public void dragEnter(DropTargetDragEvent dropTargetDragEvent) {
|
||||
dropTargetDragEvent.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
|
||||
}
|
||||
|
||||
public void dragExit(DropTargetEvent dropTargetEvent) {
|
||||
}
|
||||
|
||||
public void dragOver(DropTargetDragEvent dropTargetDragEvent) {
|
||||
}
|
||||
|
||||
public void dropActionChanged(DropTargetDragEvent dropTargetDragEvent) {
|
||||
}
|
||||
|
||||
public void drop(DropTargetDropEvent dropTargetDropEvent) {
|
||||
try {
|
||||
Transferable transferable = dropTargetDropEvent.getTransferable();
|
||||
if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
dropTargetDropEvent.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
|
||||
List fileList = (List)transferable.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
Iterator iterator = fileList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
File file = (File)iterator.next();
|
||||
if (file.isFile()) {
|
||||
fileDropped(file);
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
directoryDropped(file);
|
||||
}
|
||||
}
|
||||
dropTargetDropEvent.getDropTargetContext().dropComplete(true);
|
||||
}
|
||||
else {
|
||||
dropTargetDropEvent.rejectDrop();
|
||||
}
|
||||
}
|
||||
catch (Exception io) {
|
||||
Log.error(io);
|
||||
dropTargetDropEvent.rejectDrop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notified when a file has been dropped onto the frame.
|
||||
*
|
||||
* @param file the file that has been dropped.
|
||||
*/
|
||||
public abstract void fileDropped(File file);
|
||||
|
||||
/**
|
||||
* Notified when a directory has been dropped onto the frame.
|
||||
*
|
||||
* @param file the directory that has been dropped.
|
||||
*/
|
||||
public abstract void directoryDropped(File file);
|
||||
}
|
||||
105
src/java/org/jivesoftware/spark/component/HTMLViewer.java
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
|
||||
/**
|
||||
* Creates a new CoBrowser component. The CoBrowser is ChatRoom specific and is used
|
||||
* to control the end users browser. Using the CoBrowser allows you to assist end customers
|
||||
* by directing them to the appropriate site.
|
||||
*/
|
||||
public class HTMLViewer extends JPanel {
|
||||
private JEditorPane browser;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new CoBrowser object to be used with the specifid ChatRoom.
|
||||
*/
|
||||
public HTMLViewer() {
|
||||
final JPanel mainPanel = new JPanel();
|
||||
browser = new JEditorPane();
|
||||
browser.setEditorKit(new HTMLEditorKit());
|
||||
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
this.add(mainPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTML content of the viewer.
|
||||
*
|
||||
* @param text the html content.
|
||||
*/
|
||||
public void setHTMLContent(String text) {
|
||||
browser.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a URL into the Viewer.
|
||||
*
|
||||
* @param url the url.
|
||||
*/
|
||||
public void loadURL(String url) {
|
||||
try {
|
||||
if (url.startsWith("www")) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
browser.setPage(url);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the selected text contained in this TextComponent. If the selection is null or the document empty, returns null.
|
||||
*
|
||||
* @return the text.
|
||||
*/
|
||||
public String getSelectedText() {
|
||||
return browser.getSelectedText();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Let's make sure that the panel doesn't strech past the
|
||||
* scrollpane view pane.
|
||||
*
|
||||
* @return the preferred dimension
|
||||
*/
|
||||
public Dimension getPreferredSize() {
|
||||
final Dimension size = super.getPreferredSize();
|
||||
size.width = 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a hyperlink listener for notification of any changes, for example when a link is selected and entered.
|
||||
*
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void setHyperlinkListener(HyperlinkListener listener) {
|
||||
browser.addHyperlinkListener(listener);
|
||||
}
|
||||
}
|
||||
122
src/java/org/jivesoftware/spark/component/IconTextField.java
Normal file
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
|
||||
/**
|
||||
* Creates a Firefox Search type box that allows for icons inside of a textfield. This
|
||||
* could be used to build out your own search objects.
|
||||
*/
|
||||
public class IconTextField extends JPanel {
|
||||
private JTextField textField;
|
||||
private JLabel imageComponent;
|
||||
private JLabel downOption;
|
||||
|
||||
/**
|
||||
* Creates a new IconTextField with Icon.
|
||||
*
|
||||
* @param icon the icon.
|
||||
*/
|
||||
public IconTextField(Icon icon) {
|
||||
setLayout(new GridBagLayout());
|
||||
setBackground((Color)UIManager.get("TextField.background"));
|
||||
|
||||
textField = new JTextField();
|
||||
textField.setBorder(null);
|
||||
setBorder(new JTextField().getBorder());
|
||||
|
||||
imageComponent = new JLabel(icon);
|
||||
downOption = new JLabel(SparkRes.getImageIcon(SparkRes.DOWN_OPTION_IMAGE));
|
||||
|
||||
add(downOption, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
add(imageComponent, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
|
||||
add(textField, new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0), 0, 0));
|
||||
|
||||
downOption.setVisible(false);
|
||||
}
|
||||
|
||||
public void enableDropdown(boolean enable) {
|
||||
downOption.setVisible(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text of the textfield.
|
||||
*
|
||||
* @param text the text.
|
||||
*/
|
||||
public void setText(String text) {
|
||||
textField.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text inside of the textfield.
|
||||
*
|
||||
* @return the text inside of the textfield.
|
||||
*/
|
||||
public String getText() {
|
||||
return textField.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon to use inside of the textfield.
|
||||
*
|
||||
* @param icon the icon.
|
||||
*/
|
||||
public void setIcon(Icon icon) {
|
||||
imageComponent.setIcon(icon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current icon used in the textfield.
|
||||
*
|
||||
* @return the icon used in the textfield.
|
||||
*/
|
||||
public Icon getIcon() {
|
||||
return imageComponent.getIcon();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component that holds the icon.
|
||||
*
|
||||
* @return the component that is the container for the icon.
|
||||
*/
|
||||
public JComponent getImageComponent() {
|
||||
return imageComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text component used.
|
||||
*
|
||||
* @return the text component used.
|
||||
*/
|
||||
public JTextField getTextComponent() {
|
||||
return textField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
163
src/java/org/jivesoftware/spark/component/ImageTitlePanel.java
Normal file
@ -0,0 +1,163 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Insets;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
/**
|
||||
* Fancy title panel that displays gradient colors, text and components.
|
||||
*/
|
||||
public class ImageTitlePanel extends JPanel {
|
||||
private Image backgroundImage;
|
||||
private final JLabel titleLabel = new JLabel();
|
||||
private final JLabel iconLabel = new JLabel();
|
||||
private final GridBagLayout gridBagLayout = new GridBagLayout();
|
||||
private final WrappedLabel descriptionLabel = new WrappedLabel();
|
||||
|
||||
/**
|
||||
* Creates a new ImageTitlePanel.
|
||||
*
|
||||
* @param title the title to use for this label.
|
||||
*/
|
||||
public ImageTitlePanel(String title) {
|
||||
ImageIcon icons = new ImageIcon(getClass().getResource("/images/header-stretch.gif"));
|
||||
backgroundImage = icons.getImage();
|
||||
|
||||
init();
|
||||
|
||||
titleLabel.setText(title);
|
||||
titleLabel.setForeground(Color.white);
|
||||
titleLabel.setFont(new Font("Verdana", Font.BOLD, 11));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ImageTitlePanel object.
|
||||
*/
|
||||
public ImageTitlePanel() {
|
||||
ImageIcon icons = new ImageIcon(getClass().getResource("/images/header-stretch.gif"));
|
||||
backgroundImage = icons.getImage();
|
||||
|
||||
init();
|
||||
|
||||
titleLabel.setForeground(Color.white);
|
||||
titleLabel.setFont(new Font("Verdana", Font.BOLD, 11));
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setLayout(gridBagLayout);
|
||||
add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description for the label.
|
||||
*
|
||||
* @param description the description for the label.
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
descriptionLabel.setText(description);
|
||||
add(descriptionLabel, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the font of the description label.
|
||||
*
|
||||
* @param font the font to use in the description label.
|
||||
*/
|
||||
public void setDescriptionFont(Font font) {
|
||||
descriptionLabel.setFont(font);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description label.
|
||||
*
|
||||
* @return the description label.
|
||||
*/
|
||||
public JTextArea getDescriptionLabel() {
|
||||
return descriptionLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title to use in the label.
|
||||
*
|
||||
* @param title the title to use.
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
titleLabel.setText(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title label.
|
||||
*
|
||||
* @return the title label.
|
||||
*/
|
||||
public JLabel getTitleLabel() {
|
||||
return titleLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the font of the title label.
|
||||
*
|
||||
* @param font the font to use for title label.
|
||||
*/
|
||||
public void setTitleFont(Font font) {
|
||||
titleLabel.setFont(font);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a component to use on this label.
|
||||
*
|
||||
* @param component the component to use with this label.
|
||||
*/
|
||||
public void setComponent(JComponent component) {
|
||||
add(new JLabel(),
|
||||
new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(component,
|
||||
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the icon to use with this label.
|
||||
*
|
||||
* @param icon the icon to use with this label.
|
||||
*/
|
||||
public void setIcon(ImageIcon icon) {
|
||||
add(new JLabel(),
|
||||
new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
iconLabel.setIcon(icon);
|
||||
add(iconLabel,
|
||||
new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST,
|
||||
GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
}
|
||||
}
|
||||
162
src/java/org/jivesoftware/spark/component/InputDialog.java
Normal file
@ -0,0 +1,162 @@
|
||||
/**
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 2006 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is published under the terms of the GNU Lesser Public License (LGPL),
|
||||
* a copy of which is included in this distribution.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.spark.component;
|
||||
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
|
||||
/**
|
||||
* <code>InputDialog</code> class is used to retrieve information from a user.
|
||||
*
|
||||
* @version 1.0, 06/03/2005
|
||||
*/
|
||||
public final class InputDialog implements PropertyChangeListener {
|
||||
private JTextArea textArea;
|
||||
private JOptionPane optionPane;
|
||||
private JDialog dialog;
|
||||
|
||||
private String stringValue;
|
||||
private int width = 400;
|
||||
private int height = 250;
|
||||
|
||||
/**
|
||||
* Empty Constructor.
|
||||
*/
|
||||
public InputDialog() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input from a user.
|
||||
*
|
||||
* @param title the title of the dialog.
|
||||
* @param description the dialog description.
|
||||
* @param icon the icon to use.
|
||||
* @param width the dialog width
|
||||
* @param height the dialog height
|
||||
* @return the users input.
|
||||
*/
|
||||
public String getInput(String title, String description, Icon icon, int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
return getInput(title, description, icon, SparkManager.getMainWindow());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt and return input.
|
||||
*
|
||||
* @param title the title of the dialog.
|
||||
* @param description the dialog description.
|
||||
* @param icon the icon to use.
|
||||
* @param parent the parent to use.
|
||||
* @return the user input.
|
||||
*/
|
||||
public String getInput(String title, String description, Icon icon, Component parent) {
|
||||
textArea = new JTextArea();
|
||||
textArea.setLineWrap(true);
|
||||
|
||||
TitlePanel titlePanel = new TitlePanel(title, description, icon, true);
|
||||
|
||||
// Construct main panel w/ layout.
|
||||
final JPanel mainPanel = new JPanel();
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
||||
|
||||
// The user should only be able to close this dialog.
|
||||
final Object[] options = {"Ok", "Cancel"};
|
||||
optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE,
|
||||
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
||||
|
||||
mainPanel.add(optionPane, BorderLayout.CENTER);
|
||||
|
||||
// Let's make sure that the dialog is modal. Cannot risk people
|
||||
// losing this dialog.
|
||||
JOptionPane p = new JOptionPane();
|
||||
dialog = p.createDialog(parent, title);
|
||||
dialog.setModal(true);
|
||||
dialog.pack();
|
||||
dialog.setSize(width, height);
|
||||
dialog.setContentPane(mainPanel);
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
optionPane.addPropertyChangeListener(this);
|
||||
|
||||
// Add Key Listener to Send Field
|
||||
textArea.addKeyListener(new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyChar() == KeyEvent.VK_TAB) {
|
||||
optionPane.requestFocus();
|
||||
}
|
||||
else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
|
||||
dialog.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
textArea.requestFocus();
|
||||
|
||||
|
||||
dialog.setVisible(true);
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move to focus forward action.
|
||||
*/
|
||||
public Action nextFocusAction = new AbstractAction("Move Focus Forwards") {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
((Component)evt.getSource()).transferFocus();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves the focus backwards in the dialog.
|
||||
*/
|
||||
public Action prevFocusAction = new AbstractAction("Move Focus Backwards") {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
((Component)evt.getSource()).transferFocusBackward();
|
||||
}
|
||||
};
|
||||
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
String value = (String)optionPane.getValue();
|
||||
if ("Cancel".equals(value)) {
|
||||
stringValue = null;
|
||||
dialog.setVisible(false);
|
||||
}
|
||||
else if ("Ok".equals(value)) {
|
||||
stringValue = textArea.getText();
|
||||
if (stringValue.trim().length() == 0) {
|
||||
stringValue = null;
|
||||
}
|
||||
else {
|
||||
stringValue = stringValue.trim();
|
||||
}
|
||||
dialog.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||