--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/.classpath Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="C:/Documents and Settings/TasneemS/eclipse/workspace/org.bluecove_2.1.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/.project Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.bluecove.Ver2.1.1</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/.settings/org.eclipse.jdt.core.prefs Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,8 @@
+#Wed Jan 27 23:37:09 PST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/META-INF/MANIFEST.MF Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: BlueCove
+Bundle-SymbolicName: org.bluecove.v2_1_1
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.bluecove.ver2_1_1.Activator
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: com.intel.bluetooth,
+ javax.bluetooth,
+ javax.microedition.io,
+ javax.obex
+Export-Package: com.intel.bluetooth,
+ javax.bluetooth,
+ javax.microedition.io,
+ javax.obex
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/build.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.bluecove.Ver2.1.1/src/org/bluecove/ver2_1_1/Activator.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,50 @@
+package org.bluecove.ver2_1_1;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.bluecove.v2_1_1";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
--- a/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/META-INF/MANIFEST.MF Tue Feb 02 08:17:07 2010 -0800
@@ -10,7 +10,7 @@
org.eclipse.core.net;bundle-version="1.2.0",
org.mozilla.xpcom;bundle-version="1.9.1";resolution:=optional,
org.eclipse.equinox.http.jetty;bundle-version="2.0.0",
- org.eclipse.wst.jsdt.core;bundle-version="1.0.201",
+ org.eclipse.wst.jsdt.core;bundle-version="1.0.200",
org.eclipse.wst.jsdt.ui;bundle-version="1.0.200",
org.symbian.tools.wrttools;bundle-version="1.0.0",
org.mozilla.xulrunner;bundle-version="1.9.1";resolution:=optional
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WorkspaceResourcesServlet.java Tue Feb 02 08:17:07 2010 -0800
@@ -132,7 +132,7 @@
private String readFile(IProject project, String fileName)
throws CoreException, UnsupportedEncodingException, IOException {
- IFile file = project.getFile(fileName);
+ IFile file = getFile(project, fileName);
if (file.isAccessible()) {
InputStream contents = file.getContents();
final BufferedReader reader = new BufferedReader(
@@ -152,6 +152,19 @@
return null;
}
+ private IFile getFile(IProject project, String fileName) throws CoreException {
+ String n = fileName.toLowerCase();
+ IResource[] members = project.members();
+ for (IResource iResource : members) {
+ if (iResource.getType() == IResource.FILE
+ && n.equals(iResource.getName().toLowerCase())
+ && iResource.isAccessible()) {
+ return (IFile) iResource;
+ }
+ }
+ return null;
+ }
+
private InputStream getPluginResourceStream(IPath path) throws IOException {
URL url = FileLocator.find(PreviewerPlugin.getDefault().getBundle(),
path, null);
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java Tue Feb 02 08:17:07 2010 -0800
@@ -170,5 +170,8 @@
public void setSelection(ISelection selection) {
// Do nothing
}
-
+
+ public boolean isDisposed() {
+ return browser != null && browser.isDisposed();
+ }
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/IPreviewPage.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/IPreviewPage.java Tue Feb 02 08:17:07 2010 -0800
@@ -7,4 +7,5 @@
public interface IPreviewPage extends IPageBookViewPage {
void process(Collection<IFile> files);
+ boolean isDisposed();
}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewView.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/PreviewView.java Tue Feb 02 08:17:07 2010 -0800
@@ -107,7 +107,7 @@
IProject project = resource.getProject();
IPreviewPage page = projectToPage.get(project);
- if (page == null) {
+ if (page == null || page.isDisposed()) {
page = createPreviewPage(project);
initPage(page);
page.createControl(getPageBook());
--- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Windows).launch Tue Feb 02 08:17:07 2010 -0800
@@ -21,8 +21,8 @@
<stringAttribute key="product" value="org.symbian.tools.wrttools.product.product"/>
<stringAttribute key="productFile" value="\org.symbian.tools.wrttools.product\wrt-ide.product"/>
<booleanAttribute key="restart" value="false"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.wst.common.ui@default:default,org.apache.axis@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.ui.intro@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.wst.standard.schemas@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.apache.velocity@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.wst.internet.cache@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.apache.lucene.analysis@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.sat4j.pb@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,javax.xml.rpc@default:default,org.apache.commons.lang*2.3.0.v200803061910@default:default,javax.activation*1.1.0.v200906290531@default:default,org.apache.commons.codec@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.core.databinding.observable@default:default,org.eclipse.equinox.security.macosx@default:false,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.equinox.http.registry@default:default,org.eclipse.update.configurator@3:true,org.eclipse.ui.workbench@default:default,org.eclipse.wst.validation@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.platform.doc.user@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.common.emf@default:default,org.apache.commons.logging@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.jdt.launching.ui.macosx@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.emf.common@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.wst.doc.user@default:default,javax.xml.soap@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.objectweb.asm@default:default,org.eclipse.jsch.core@default:default,org.apache.commons.jxpath@default:default,org.eclipse.jem@default:default,org.apache.oro@default:default,org.eclipse.help.base@default:default,org.eclipse.equinox.launcher.cocoa.macosx.x86_64@default:false,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.rcp@default:default,org.eclipse.wst.command.env@default:default,org.hamcrest.core@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.ui.views.log@default:default,org.apache.xalan@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.wst.validation.ui@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.dstore.extra@default:default,javax.xml.bind*2.0.0.v20080604-1500@default:default,org.eclipse.wst.command.env.infopop@default:default,org.apache.xerces@default:default,org.eclipse.help@default:default,org.eclipse.swt@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.core.net@default:default,javax.transaction@default:false,org.eclipse.ecf.identity@default:default,org.eclipse.equinox.app@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.dstore.core@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.ds@1:true,org.apache.commons.net@default:default,org.apache.commons.collections@default:default,org.eclipse.core.boot@default:default,org.eclipse.core.resources@default:default,org.jdom@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.p2.publisher@default:default,org.apache.log4j@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.update.ui@default:default,org.mozilla.xulrunner@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.emf.mapping.ecore2ecore@default:default,org.eclipse.wst.command.env.doc.user@default:default,javax.servlet.jsp@default:default,org.mozilla.xpcom@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,net.sourceforge.lpg.lpgjavaruntime@default:default,org.eclipse.gef@default:default,org.eclipse.core.runtime@default:true,org.eclipse.wst.command.env.core@default:default,org.apache.xml.resolver@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.help.appserver@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.p2.exemplarysetup@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.wst.common.core@default:default,commonj.sdo@default:default,org.eclipse.team.ui@default:default,org.eclipse.compare.win32@default:default,org.eclipse.search@default:default,org.apache.bcel@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.browser@default:default,org.eclipse.jsch.ui@default:default,javax.persistence@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.wst.xml.core@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.emf@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.debug.core@default:default,org.eclipse.core.variables@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.equinox.p2.ui@default:default,org.eclipse.ui.net@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.wst.html.core@default:default,javax.wsdl*1.5.1.v200806030408@default:default,org.eclipse.team.cvs.ssh@default:default,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.mortbay.jetty.server@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.epp.package.jee@default:default,org.apache.commons.el@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.http.servlet@default:default,com.ibm.icu@default:default,org.eclipse.team.core@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.mortbay.jetty.util@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.ui.views@default:default,javax.xml.stream@default:default,org.eclipse.core.expressions@default:default,org.eclipse.jem.util@default:default,org.sat4j.core@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.net4j.jms.api@default:default,org.eclipse.cvs@default:default,org.apache.commons.httpclient@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.osgi.services@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.jdt.launching.macosx@default:default,org.eclipse.wtp.epp.package.jee.intro@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.eclipse.core.commands@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.help.ui@default:default,org.eclipse.ecf@default:default,org.eclipse.debug.ui@default:default,org.apache.lucene@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.resources.compatibility@default:false,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.team.cvs.ui@default:default,org.apache.xml.serializer@default:default,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.wst.internet.monitor.ui@default:default,javax.servlet@default:default,com.jcraft.jsch@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.help.webapp@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.emf.mapping.ui@default:default,org.eclipse.compare@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.ui.forms@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.equinox.security.ui@default:default,org.apache.jasper@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.ui@default:default,org.eclipse.ui.editors@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.compare.core@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,java_cup.runtime@default:default,org.eclipse.ui.console@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.util@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,javax.xml@default:default,org.apache.commons.discovery@default:default,javax.wsdl*1.6.2.v200806030405@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.platform@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ui.win32@default:false,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.emf.mapping@default:default,org.eclipse.draw2d@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.update.core@default:default,org.eclipse.core.databinding@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.emf.edit@default:default,javax.mail*1.4.0.v200905040518@default:default,javax.xml.bind*2.1.9.v200905050702@default:default,org.eclipse.wst.common.frameworks@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools@default:default,org.chromium.sdk@default:default,org.symbian.tools.wrttools.previewer@default:default,org.chromium.debug.ui@default:default,org.chromium.debug.core@default:default,org.symbian.tools.wrttools.product@default:default,org.symbian.tools.wrttools.debug.core@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.win32@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.wst.sse.ui@default:default,org.apache.commons.jxpath@default:default,org.eclipse.help@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.apache.commons.net@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.wst.xml.core@default:default,org.apache.bcel@default:default,org.eclipse.epp.package.jee@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.core.commands@default:default,org.eclipse.wst.common.uriresolver@default:default,org.mozilla.xulrunner.win32.win32.x86@default:false,org.eclipse.core.resources.compatibility@default:false,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.emf.mapping.ecore2ecore@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.equinox.launcher.win32.win32.x86@default:false,org.jdom@default:default,com.ibm.icu@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.equinox.http.registry@default:default,javax.xml.rpc@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.equinox.p2.exemplarysetup@default:default,org.apache.lucene.analysis@default:default,org.apache.jasper@default:default,commonj.sdo@default:default,org.eclipse.emf.ecore.xmi@default:default,org.mortbay.jetty.util@default:default,org.eclipse.dstore.extra@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.text@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.wst.sse.doc.user@default:default,org.objectweb.asm@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.launcher.cocoa.macosx.x86_64@default:false,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.jsch.ui@default:default,javax.xml.soap@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.debug.core@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.ecf.filetransfer@default:default,org.apache.oro@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.ui.intro.universal@default:default,javax.transaction@default:false,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.update.core.win32@default:false,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.net4j.jms.api@default:default,org.eclipse.help.base@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.core.net@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.platform@default:default,org.eclipse.ecf.identity@default:default,org.apache.axis@default:default,javax.xml.bind*2.1.9.v200905050702@default:default,org.eclipse.core.variables@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.wst.command.env.core@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.osgi@-1:true,org.eclipse.wst.common.emf@default:default,org.eclipse.core.runtime@default:true,org.eclipse.wst.command.env.infopop@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.apache.log4j@default:default,org.eclipse.ui.editors@default:default,org.eclipse.emf.databinding.edit@default:default,org.eclipse.swt@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.ui.net@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.equinox.security@default:default,org.apache.xalan@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ui.forms@default:default,org.eclipse.emf.databinding@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.emf.mapping.ecore.editor@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.emf.edit@default:default,org.eclipse.ui.views@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.core.resources@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.help.webapp@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.core.databinding.beans@default:default,org.mozilla.xulrunner@default:default,org.eclipse.equinox.util@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.help.appserver@default:default,org.apache.commons.el@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.wst.common.frameworks@default:default,net.sourceforge.lpg.lpgjavaruntime@default:default,org.eclipse.wst.common.environment@default:default,javax.servlet.jsp@default:default,org.eclipse.equinox.p2.publisher@default:default,org.hamcrest.core@default:default,org.eclipse.wst.validation.infopop@default:default,org.apache.xml.serializer@default:default,org.sat4j.pb@default:default,org.apache.lucene@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.jdt.launching.ui.macosx@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.compare@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.p2.ui@default:default,org.eclipse.osgi.util@default:default,org.eclipse.wtp.epp.package.jee.intro@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.ui.console@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.cvs@default:default,com.jcraft.jsch@default:default,org.apache.commons.codec@default:default,org.eclipse.equinox.security.macosx@default:false,java_cup.runtime@default:default,org.apache.commons.logging@default:default,javax.wsdl*1.5.1.v200806030408@default:default,org.eclipse.search@default:default,org.eclipse.help.ui@default:default,org.eclipse.wst.xml.xpath.core@default:default,javax.persistence@default:default,org.eclipse.emf.mapping.ui@default:default,org.mozilla.xpcom@default:default,org.eclipse.draw2d@default:default,org.eclipse.osgi.services@default:default,org.eclipse.compare.win32@default:default,org.eclipse.debug.ui@default:default,javax.wsdl*1.6.2.v200806030405@default:default,org.eclipse.emf.common@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.apache.commons.collections@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.team.core@default:default,org.eclipse.wst.command.env.doc.user@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.update.configurator@3:true,org.eclipse.wst.css.ui@default:default,javax.servlet@default:default,javax.xml@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.emf.mapping.ecore@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,javax.mail*1.4.0.v200905040518@default:default,org.eclipse.jface@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.jdt.launching.macosx@default:default,org.eclipse.ui@default:default,org.eclipse.dstore.core@default:default,org.eclipse.team.cvs.ssh@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.wst.validation@default:default,javax.xml.bind*2.0.0.v20080604-1500@default:default,org.eclipse.emf.ecore.change.edit@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.apache.commons.lang*2.3.0.v200803061910@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.update.core@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.emf@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.director@default:default,org.apache.commons.discovery@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.jobs@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.sat4j.core@default:default,org.apache.xml.resolver@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.mapping.ecore2xml@default:default,org.eclipse.ecf@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.jem.util@default:default,org.eclipse.wst.command.env@default:default,org.apache.commons.httpclient@default:default,org.eclipse.equinox.p2.core@default:default,org.apache.velocity@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.emf.mapping@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.databinding@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.swt.win32.win32.x86@default:false,org.eclipse.equinox.app@default:default,org.mortbay.jetty.server@default:default,org.eclipse.team.ui@default:default,javax.xml.stream@default:default,org.eclipse.gef@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.compare.core@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.equinox.common@2:true,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.ui.ide@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.core.boot@default:default,org.eclipse.rcp@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.ui.browser@default:default,org.eclipse.jem@default:default,org.eclipse.wst.common.ui@default:default,javax.activation*1.1.0.v200906290531@default:default,org.apache.xerces@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.chromium.debug.ui@default:default,org.symbian.tools.wrttools.product@default:default,org.symbian.tools.wrttools.previewer@default:default,org.chromium.sdk@default:default,org.symbian.tools.wrttools@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.chromium.debug.core@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
--- a/org.symbian.tools.wrttools.product/wrt-ide.product Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools.product/wrt-ide.product Tue Feb 02 08:17:07 2010 -0800
@@ -32,7 +32,6 @@
</win>
</launcher>
-
<vm>
<macos>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5</macos>
<windows>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</windows>
@@ -254,6 +253,7 @@
<plugin id="org.eclipse.wst.css.core"/>
<plugin id="org.eclipse.wst.css.ui"/>
<plugin id="org.eclipse.wst.doc.user"/>
+ <plugin id="org.eclipse.wst.dtd.core"/>
<plugin id="org.eclipse.wst.html.core"/>
<plugin id="org.eclipse.wst.html.ui"/>
<plugin id="org.eclipse.wst.html.ui.infopop"/>
Binary file org.symbian.tools.wrttools/icons/Thumbs.db has changed
Binary file org.symbian.tools.wrttools/icons/exclude_archive.gif has changed
Binary file org.symbian.tools.wrttools/icons/include_archive.gif has changed
Binary file org.symbian.tools.wrttools/icons/package_widget.gif has changed
--- a/org.symbian.tools.wrttools/plugin.xml Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/plugin.xml Tue Feb 02 08:17:07 2010 -0800
@@ -59,7 +59,7 @@
</validator>
</extension>
-<!-- Validation markers -->
+<!-- Validator Marker -->
<extension
id="org.symbian.tools.wrttools.core.validator.marker"
@@ -69,25 +69,87 @@
<persistent value ="true"/>
</extension>
+<!-- WRT Tool Integration (Package, Validate, Include, Exclude Settings)-->
<extension
point="org.eclipse.ui.popupMenus">
- <objectContribution
+ <objectContribution
+ objectClass="org.eclipse.core.resources.IResource"
+ adaptable="true"
+ id="org.symbian.tools.wrttools.widget.wrttool">
+ <filter
+ name="projectNature"
+ value="org.symbian.tools.wrttools.WidgetProjectNature"/>
+ <action
+ class="org.symbian.tools.wrttools.core.packager.WrtPackageActionDelegate"
+ enablesFor="+"
+ icon="icons/package_widget.gif"
+ id="org.symbian.tools.wrttools.widget.package.WrtPackageActionDelegate"
+ label="Package Widget"
+ menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker">
+ </action>
+ </objectContribution>
+ <objectContribution
adaptable="true"
- id="com.nokia.wrt.core.validator"
+ id="org.symbian.tools.wrttools.core.validator"
objectClass="org.eclipse.core.resources.IResource">
<filter
name="projectNature"
value="org.symbian.tools.wrttools.WidgetProjectNature"/>
<action
- class="com.nokia.wrt.core.validator.ValidateAction"
+ class="org.symbian.tools.wrttools.core.validator.ValidateAction"
enablesFor="+"
icon="icons/validate_widget.gif"
- id="com.nokia.wrt.core.validator.ValidateAction"
+ id="org.symbian.tools.wrttools.core.validator.ValidateAction"
label="Validate Widget"
- menubarPath="com.nokia.wrt.contextMenuGroupMarker">
+ menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker">
</action>
- </objectContribution>
- </extension>
+ </objectContribution>
+ <objectContribution
+ objectClass="org.eclipse.core.resources.IResource"
+ id="org.symbian.tools.wrttools.widget.wrttool.packageoptions">
+ <visibility>
+ <not>
+ <or>
+ <objectState name="persistentProperty" value="org.symbian.tools.wrttools.packager.exclude"/>
+ <objectState name="extension" value="plist"/>
+ <objectClass name="org.eclipse.core.resources.IProject"/>
+ </or>
+ </not>
+ </visibility>
+ <filter
+ name="projectNature"
+ value="org.symbian.tools.wrttools.WidgetProjectNature"/>
+ <action
+ class="org.symbian.tools.wrttools.core.packager.ExcludeFileAction"
+ icon="icons/exclude_archive.gif"
+ id="org.symbian.tools.wrttools.widget.wrttool.packageoptions.ExcludeFileAction"
+ label="Exclude From Widget Archive"
+ menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker">
+ </action>
+ </objectContribution>
+ <objectContribution
+ objectClass="org.eclipse.core.resources.IResource"
+ id="org.symbian.tools.wrttools.widget.wrttool.packageoptions">
+ <visibility>
+ <and>
+ <not>
+ <objectState name="extension" value="wgz"/>
+ </not>
+ <and>
+ <objectState name="persistentProperty" value="org.symbian.tools.wrttools.packager.exclude"/>
+ <objectState name="projectNature" value="org.symbian.tools.wrttools.WidgetProjectNature"/>
+ </and>
+ </and>
+ </visibility>
+ <action
+ class="org.symbian.tools.wrttools.core.packager.IncludeFileAction"
+ icon="icons/include_archive.gif"
+ id="org.symbian.tools.wrttools.widget.wrttool.packageoptions.IncludeFileAction"
+ label="Include in Widget Archive"
+ menubarPath="org.symbian.tools.wrttools.contextMenuGroupMarker">
+ </action>
+ </objectContribution>
+ </extension>
<!-- WRT Project Templates - CSS Validator -->
<extension-point id="projectTemplates" name="WRT application project templates" schema="schema/projectTemplates.exsd"/>
@@ -145,6 +207,44 @@
This wizard generates an empty widget project with a minimal Info.plist, html,css and js.
</description>
</projectTemplate>
+ <projectTemplate
+ archive="projecttemplates/wrtkit.zip"
+ default-css-name="basic"
+ default-html-name="index"
+ default-js-name="basic"
+ icon="icons/main16.gif"
+ id-pattern="com.{0}.basic.widget"
+ name="Basic WRT Project with WRTKit Support">
+ <description>
+ This wizard generates an basic project with a minimal Info.plist, html,css and js along with WRTKit.
+ </description>
+ </projectTemplate>
+ <projectTemplate
+ archive="projecttemplates/flickr.zip"
+ default-css-name="Flickr"
+ default-html-name="index"
+ default-js-name="Flickr"
+ icon="icons/flickr.gif"
+ id-pattern="com.{0}.flickr.widget"
+ name="Flickr Application Project"
+ wizard-page-factory="org.symbian.tools.wrttools.wizards.FlickrProjectDetailsWizardPage$Factory">
+ <description>
+ This wizard generates an Flickr project with a minimal Info.plist, html,css and js and WRTKit.
+ </description>
+ </projectTemplate>
+ <projectTemplate
+ archive="projecttemplates/rssreader.zip"
+ default-css-name="RSSReader"
+ default-html-name="index"
+ default-js-name="RSSReader"
+ icon="icons/rss.gif"
+ id-pattern="com.{0}.rssreader.widget"
+ name="RSS Reader Application Project"
+ wizard-page-factory="org.symbian.tools.wrttools.wizards.RssReaderProjectDetailsWizardPage$Factory">
+ <description>
+ This wizard generates an RSS Reader project with a minimal Info.plist, html,css and js and WRTKit.
+ </description>
+ </projectTemplate>
</extension>
<!-- Import Wizard -->
@@ -156,13 +256,6 @@
icon="icons/main16.gif" id="org.symbian.tools.wrttools.import.aptanaImport"
name="Aptana IDE WRT Project">
</wizard>
- <wizard
- category="org.symbian.tools.wrttools.import"
- class="org.symbian.tools.wrttools.wizards.WgzImportWizard"
- icon="icons/main16.gif"
- id="org.symbian.tools.wrttools.importwgz"
- name="Import WRT Application Archive">
- </wizard>
</extension>
<!-- Problem Markers -->
@@ -450,29 +543,9 @@
<adapt
type="org.eclipse.core.resources.IResource">
</adapt>
- <adapt
- type="java.util.Collection">
- <count
- value="0">
- </count>
- </adapt>
- </or>
- </enablement>
- </commonWizard>
- <commonWizard
- type="import"
- wizardId="org.symbian.tools.wrttools.importwgz">
- <enablement>
- <or>
- <adapt
- type="org.eclipse.core.resources.IResource">
- </adapt>
- <adapt
- type="java.util.Collection">
- <count
- value="0">
- </count>
- </adapt>
+ <count
+ value="0">
+ </count>
</or>
</enablement>
</commonWizard>
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/CheckBox.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ContentPanelFoldIcons.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ControlAssemblyBackground.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/DocumentBackground.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/FormButtonCenter.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/FormButtonLeft.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/FormButtonRight.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ListViewCaptionBackground.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/NotificationPopupBackground.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/NotificationPopupTypeIndicator.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar0.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar10.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar100.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar20.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar30.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar40.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar50.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar60.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar70.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar80.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBar90.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ProgressBarUnknown.gif has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/RadioButton.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarThumbBottom.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarThumbMiddle.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarThumbTop.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarTrackBottom.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarTrackMiddle.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/ScrollbarTrackTop.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/SeparatorCenter.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/SeparatorLeft.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/SeparatorRight.png has changed
Binary file org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/Thumbs.db has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/Resources/UI.css Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,912 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+/******************************************************************************/
+/* Definition of visuals for the WRTKit user interface toolkit */
+/******************************************************************************/
+
+/******************************************************************************/
+/* Document body rules */
+
+body {
+ margin: 0px;
+ background: url("DocumentBackground.png") repeat-x fixed;
+ font: normal 12px Arial, sans-serif;
+ color: rgb(0,0,0);
+}
+
+
+/******************************************************************************/
+/* Override default WRT styling for HTML form controls */
+
+/* Textarea when focused */
+textarea:focus {
+ outline: none;
+}
+
+/* Textarea when hovering */
+textarea:hover {
+ outline: none;
+}
+
+/* Select elements when focused */
+select:focus {
+ outline: none;
+}
+
+/* Select elements when hovering */
+select:hover {
+ outline: none;
+}
+
+/* Input elements when focused */
+input:focus {
+ outline: none;
+}
+
+/* Input elements when hovering */
+input:hover {
+ outline: none;
+}
+
+/* Link elements */
+a {
+ text-decoration: none;
+ color: rgb(0,0,0);
+}
+
+/* Links when focused */
+a:focus {
+ background: none;
+ outline: none;
+}
+
+/* Links when hovering */
+a:hover {
+ background: none;
+ outline: none;
+}
+
+
+/******************************************************************************/
+/* Rules for default view and document scrollbar containers */
+
+/* Default view container rules */
+.ViewContainer {
+ margin: 0px 0px 0px 0px;
+}
+
+/* Default document scrollbar container rules */
+.DocumentScrollbarContainer {
+ position: fixed;
+ right: 0px;
+ top: 0px;
+ height: 100%;
+ width: 7px;
+}
+
+
+/******************************************************************************/
+/* View style rules */
+
+/* Rules for the list view */
+.ListView {
+ margin: 0px 0px 0px 0px;
+}
+
+/* Rules for the list view caption */
+.ListViewCaption {
+ background: url("ListViewCaptionBackground.png");
+ height: 35px;
+}
+
+/* Rules for the list view caption text */
+.ListViewCaptionText {
+ font-size: 18px;
+ font-weight: bold;
+ padding: 7px 0px 0px 11px;
+}
+
+/* Rules for the list view control list element */
+.ListViewControlList {
+ margin: 1px 10px 1px 3px;
+}
+
+
+/******************************************************************************/
+/* Control style rules */
+
+/* Rules for control root element (rootElement) */
+.Control {
+
+}
+
+/* Control assembly rules (assemblyElement) */
+.ControlAssembly {
+ background: url("ControlAssemblyBackground.png") repeat-x;
+ padding: 1px 5px;
+}
+
+/* Control assembly in normal state */
+.ControlAssemblyNormal {
+ background-position: 0px 0px;
+}
+
+/* Control assembly in focused state */
+.ControlAssemblyFocus {
+ background-position: 0px -250px;
+}
+
+/* Control assembly in hovering state */
+.ControlAssemblyHover {
+ background-position: 0px -500px;
+}
+
+/* Control assembly in disabled state */
+.ControlAssemblyDisabled {
+ background-position: 0px 0px;
+}
+
+/* Caption for controls (captionElement) */
+.ControlCaption {
+ font-weight: bold;
+ padding: 3px 0px 0px 3px;
+}
+
+/* Caption for controls in normal state */
+.ControlCaptionNormal {
+
+}
+
+/* Caption for controls when focused */
+.ControlCaptionFocus {
+ color: rgb(255,255,255);
+}
+
+/* Caption for controls when hovering */
+.ControlCaptionHover {
+
+}
+
+/* Caption for controls when disabled */
+.ControlCaptionDisabled {
+ color: rgb(125,125,125);
+}
+
+/* Control element rules (controlElement) */
+.ControlElement {
+ padding: 3px 3px 3px 3px;
+}
+
+/******************************************************************************/
+/* Label */
+
+/* Rules for the text value of a Label control */
+.LabelText {
+
+}
+
+
+/******************************************************************************/
+/* ContentPanel */
+
+/* Caption area rules for non-foldable content panels */
+.ContentPanelCaptionNonFoldable {
+ padding: 3px 0px 0px 3px;
+}
+
+/* Caption area rules for foldable content panels */
+.ContentPanelCaptionFoldable {
+ padding: 4px 0px 3px 3px;
+}
+
+/* Rules for fold toggling element in content panel */
+.ContentPanelFoldToggle {
+ background: url("ContentPanelFoldIcons.png") no-repeat;
+ padding-left: 16px;
+}
+
+/* Collapsed fold */
+.ContentPanelFoldToggleCollapsed {
+ background-position: 0px 0px;
+}
+
+/* Expanded fold */
+.ContentPanelFoldToggleExpanded {
+ background-position: 0px -50px;
+}
+
+/* Rules for the content panel caption text */
+.ContentPanelCaptionText {
+ font-weight: bold;
+}
+
+/* Caption text for content panel in normal state */
+.ContentPanelCaptionTextNormal {
+
+}
+
+/* Caption text for content panel when focused */
+.ContentPanelCaptionTextFocus {
+ color: rgb(255,255,255);
+}
+
+/* Caption text for content panel when hovering */
+.ContentPanelCaptionTextHover {
+
+}
+
+/* Caption text for content panel when disabled */
+.ContentPanelCaptionTextDisabled {
+ color: rgb(125,125,125);
+}
+
+/* Rules for content in the content panel */
+.ContentPanelContent {
+ padding: 2px 2px 2px 8px;
+}
+
+
+/******************************************************************************/
+/* FormButton */
+
+/* Rules for form button */
+.FormButton {
+
+}
+
+/* Rules for form button control element */
+.FormButtonControlElement {
+
+}
+
+/* Rules for form button table (table) */
+.FormButtonTable {
+ width: 100%;
+ border-spacing: 0px;
+ padding: 0px;
+ table-layout: fixed;
+}
+
+/* Form button row (tr) */
+.FormButtonRow {
+ padding: 0px;
+}
+
+/* Rules for form button left cell (td) */
+.FormButtonLeftCell {
+ width: 8px;
+ height: 26px;
+ background: url("FormButtonLeft.png") no-repeat;
+ padding: 0px;
+}
+
+/* Rules for form button center cell (td) */
+.FormButtonCenterCell {
+ height: 26px;
+ background: url("FormButtonCenter.png") repeat-x;
+ padding: 0px;
+ vertical-align: middle;
+ text-align: center;
+}
+
+/* Rules for form button right cell (td) */
+.FormButtonRightCell {
+ width: 8px;
+ height: 26px;
+ background: url("FormButtonRight.png") no-repeat;
+ padding: 0px;
+}
+
+/* Rules for form button left cell in normal state (td) */
+.FormButtonLeftCellNormal {
+ background-position: 0px 0px;
+}
+
+/* Rules for form button left cell in focused state (td) */
+.FormButtonLeftCellFocus {
+ background-position: 0px -50px;
+}
+
+/* Rules for form button left cell in hover state (td) */
+.FormButtonLeftCellHover {
+ background-position: 0px -100px;
+}
+
+/* Rules for form button left cell in disabled state (td) */
+.FormButtonLeftCellDisabled {
+ background-position: 0px -150px;
+}
+
+/* Rules for form button center cell in normal state (td) */
+.FormButtonCenterCellNormal {
+ background-position: 0px 0px;
+}
+
+/* Rules for form button center cell in focused state (td) */
+.FormButtonCenterCellFocus {
+ background-position: 0px -50px;
+}
+
+/* Rules for form button center cell in hover state (td) */
+.FormButtonCenterCellHover {
+ background-position: 0px -100px;
+}
+
+/* Rules for form button center cell in disabled state (td) */
+.FormButtonCenterCellDisabled {
+ background-position: 0px -150px;
+}
+
+/* Rules for form button left cell in normal state (td) */
+.FormButtonRightCellNormal {
+ background-position: 0px 0px;
+}
+
+/* Rules for form button left cell in focused state (td) */
+.FormButtonRightCellFocus {
+ background-position: 0px -50px;
+}
+
+/* Rules for form button left cell in hover state (td) */
+.FormButtonRightCellHover {
+ background-position: 0px -100px;
+}
+
+/* Rules for form button left cell in disabled state (td) */
+.FormButtonRightCellDisabled {
+ background-position: 0px -150px;
+}
+
+/* Rules for form button text */
+.FormButtonText {
+ font-weight: bold;
+}
+
+/* Form button text in normal state */
+.FormButtonTextNormal {
+ color: rgb(255,255,255);
+}
+
+/* Form button text when focused */
+.FormButtonTextFocus {
+ color: rgb(255,255,255);
+}
+
+/* Form button text when hovering */
+.FormButtonTextHover {
+ color: rgb(255,255,255);
+}
+
+/* Form button text when disabled */
+.FormButtonTextDisabled {
+ color: rgb(200,200,200);
+}
+
+
+/******************************************************************************/
+/* NavigationButton */
+
+/* Rules for navigation button */
+.NavigationButton {
+
+}
+
+/* Rules for navigation button control element */
+.NavigationButtonControlElement {
+ padding: 3px 3px 3px 3px;
+}
+
+/* Rules for navigation button table (table) */
+.NavigationButtonTable {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+/* Navigation button row (tr) */
+.NavigationButtonRow {
+ padding: 0px;
+}
+
+/* Rules for navigation button image cell (td) */
+.NavigationButtonImageCell {
+ line-height: 1px;
+ font-size: 1px;
+ vertical-align: middle;
+}
+
+/* Rules for navigation button text cell (td) */
+.NavigationButtonTextCell {
+ vertical-align: middle;
+ padding: 0px;
+}
+
+/* Rules for navigation button image */
+.NavigationButtonImage {
+ padding: 0px 5px 0px 0px;
+}
+
+/* Rules for navigation button text */
+.NavigationButtonText {
+ font-weight: bold;
+}
+
+/* Navigation button text in normal state */
+.NavigationButtonTextNormal {
+
+}
+
+/* Navigation button text when focused */
+.NavigationButtonTextFocus {
+ color: rgb(255,255,255);
+}
+
+/* Navigation button text when hovering */
+.NavigationButtonTextHover {
+
+}
+
+/* Navigation button text when disabled */
+.NavigationButtonTextDisabled {
+ color: rgb(125,125,125);
+}
+
+
+/******************************************************************************/
+/* TextField */
+
+/* Rules for textField */
+.TextField {
+ width: 100%;
+ border: 1px solid rgb(0,0,0);
+ background: rgb(255,255,255);
+ margin: 0px 0px 3px 0px;
+}
+
+/* TextField in normal state */
+.TextFieldNormal {
+
+}
+
+/* TextField in focus state */
+.TextFieldFocus {
+
+}
+
+/* TextField in hover state */
+.TextFieldHover {
+
+}
+
+/* TextField in disabled state */
+.TextFieldDisabled {
+ color: rgb(50,50,50);
+ background: rgb(200,200,200);
+}
+
+
+/******************************************************************************/
+/* TextArea */
+
+/* Rules for TextArea */
+.TextArea {
+ width: 100%;
+ border: 1px solid rgb(0,0,0);
+ background: rgb(255,255,255);
+ margin: 0px 0px 3px 0px;
+}
+
+/* TextArea in normal state */
+.TextAreaNormal {
+
+}
+
+/* TextArea in focus state */
+.TextAreaFocus {
+
+}
+
+/* TextArea in hover state */
+.TextAreaHover {
+
+}
+
+/* TextArea in disabled state */
+.TextAreaDisabled {
+ color: rgb(50,50,50);
+ background: rgb(200,200,200);
+}
+
+
+/******************************************************************************/
+/* Separator */
+
+/* Rules for Separator (table) */
+.Separator {
+ width: 100%;
+ padding: 0px;
+ border-spacing: 0px;
+ table-layout: fixed;
+ margin: 3px 0px;
+}
+
+/* Separator row (tr) */
+.SeparatorRow {
+ padding: 0px;
+}
+
+/* Separator left cell (td) */
+.SeparatorLeftCell {
+ width: 5px;
+ height: 2px;
+ background: url("SeparatorLeft.png") no-repeat;
+ padding: 0px;
+}
+
+/* Separator center cell (td) */
+.SeparatorCenterCell {
+ height: 2px;
+ background: url("SeparatorCenter.png") repeat-x;
+ padding: 0px;
+}
+
+/* Separator right cell (td) */
+.SeparatorRightCell {
+ width: 6px;
+ height: 2px;
+ background: url("SeparatorRight.png") no-repeat;
+ padding: 0px;
+}
+
+
+/******************************************************************************/
+/* SelectionMenu */
+
+/* Rules for SelectionMenu select element */
+.SelectionMenu {
+ width: 100%;
+ border: 1px solid rgb(0,0,0);
+ background: rgb(255,255,255);
+ margin: 0px 0px 3px 0px;
+}
+
+/* SelectionMenu in normal state */
+.SelectionMenuNormal {
+
+}
+
+/* SelectionMenu in focus state */
+.SelectionMenuFocus {
+
+}
+
+/* SelectionMenu in hover state */
+.SelectionMenuHover {
+
+}
+
+/* SelectionMenu in disabled state */
+.SelectionMenuDisabled {
+ color: rgb(50,50,50);
+ background: rgb(200,200,200);
+}
+
+/* Rules for SelectionMenu option elements */
+.SelectionMenuOption {
+ background: rgb(255,255,255);
+}
+
+/* SelectionMenu option in normal state */
+.SelectionMenuOptionNormal {
+
+}
+
+/* SelectionMenu option in focus state */
+.SelectionMenuOptionFocus {
+
+}
+
+/* SelectionMenu option in hover state */
+.SelectionMenuOptionHover {
+
+}
+
+/* SelectionMenu option in disabled state */
+.SelectionMenuOptionDisabled {
+ color: rgb(50,50,50);
+ background: rgb(200,200,200);
+}
+
+
+/******************************************************************************/
+/* SelectionList */
+
+/* SelectionList option list element */
+.SelectionList {
+
+}
+
+/* SelectionList option list element in normal state */
+.SelectionListNormal {
+
+}
+
+/* SelectionList option list element in focus state */
+.SelectionListFocus {
+
+}
+
+/* SelectionList option list element in hover state */
+.SelectionListHover {
+
+}
+
+/* SelectionList option list element in disabled state */
+.SelectionListDisabled {
+
+}
+
+/* SelectionList option element in single selection mode */
+.SelectionListOptionSingle {
+ padding-left: 19px;
+ background: url("RadioButton.png") no-repeat;
+ height: 16px;
+}
+
+/* SelectionList option element in single selection mode, unchecked normal state */
+.SelectionListOptionSingleUncheckedNormal {
+ background-position: 0px 0px;
+}
+
+/* SelectionList option element in single selection mode, unchecked focus state */
+.SelectionListOptionSingleUncheckedFocus {
+ background-position: 0px -50px;
+}
+
+/* SelectionList option element in single selection mode, unchecked diabled state */
+.SelectionListOptionSingleUncheckedDisabled {
+ background-position: 0px -100px;
+}
+
+/* SelectionList option element in single selection mode, checked normal state */
+.SelectionListOptionSingleCheckedNormal {
+ background-position: 0px -150px;
+}
+
+/* SelectionList option element in single selection mode, checked focus state */
+.SelectionListOptionSingleCheckedFocus {
+ background-position: 0px -200px;
+}
+
+/* SelectionList option element in single selection mode, checked diabled state */
+.SelectionListOptionSingleCheckedDisabled {
+ background-position: 0px -250px;
+}
+
+/* SelectionList option element in multi selection mode */
+.SelectionListOptionMulti {
+ padding-left: 19px;
+ background: url("CheckBox.png") no-repeat;
+ height: 16px;
+}
+
+/* SelectionList option element in multi selection mode, unchecked normal state */
+.SelectionListOptionMultiUncheckedNormal {
+ background-position: 0px 0px;
+}
+
+/* SelectionList option element in multi selection mode, unchecked focus state */
+.SelectionListOptionMultiUncheckedFocus {
+ background-position: 0px -50px;
+}
+
+/* SelectionList option element in multi selection mode, unchecked diabled state */
+.SelectionListOptionMultiUncheckedDisabled {
+ background-position: 0px -100px;
+}
+
+/* SelectionList option element in multi selection mode, checked normal state */
+.SelectionListOptionMultiCheckedNormal {
+ background-position: 0px -150px;
+}
+
+/* SelectionList option element in multi selection mode, checked focus state */
+.SelectionListOptionMultiCheckedFocus {
+ background-position: 0px -200px;
+}
+
+/* SelectionList option element in multi selection mode, checked diabled state */
+.SelectionListOptionMultiCheckedDisabled {
+ background-position: 0px -250px;
+}
+
+/* SelectionList option text */
+.SelectionListOptionText {
+
+}
+
+/* SelectionList option text in normal state */
+.SelectionListOptionTextNormal {
+
+}
+
+/* SelectionList option text in focus state */
+.SelectionListOptionTextFocus {
+ color: rgb(255,255,255);
+}
+
+/* SelectionList option text in hover state */
+.SelectionListOptionTextHover {
+
+}
+
+/* SelectionList option text in disabled state */
+.SelectionListOptionTextDisabled {
+ color: rgb(125,125,125);
+}
+
+
+/******************************************************************************/
+/* Scrollbar */
+
+/* Scrollbar root element */
+.Scrollbar {
+ position: absolute;
+ height: 100%;
+ width: 7px;
+}
+
+/* Top portion of scrollbar track */
+.ScrollbarTrackTop {
+ position: absolute;
+ background: url("ScrollbarTrackTop.png") no-repeat;
+ width: 7px;
+ height: 4px;
+}
+
+/* Middle portion of scrollbar track */
+.ScrollbarTrackMiddle {
+ position: absolute;
+ background: url("ScrollbarTrackMiddle.png") repeat-y;
+ width: 7px;
+}
+
+/* Bottom portion of scrollbar track */
+.ScrollbarTrackBottom {
+ position: absolute;
+ background: url("ScrollbarTrackBottom.png") no-repeat;
+ width: 7px;
+ height: 4px;
+}
+
+/* Top portion of scrollbar thumb */
+.ScrollbarThumbTop {
+ position: absolute;
+ background: url("ScrollbarThumbTop.png") no-repeat;
+ width: 7px;
+ height: 5px;
+}
+
+/* Middle portion of scrollbar thumb */
+.ScrollbarThumbMiddle {
+ position: absolute;
+ background: url("ScrollbarThumbMiddle.png") repeat-y;
+ width: 7px;
+}
+
+/* Bottom portion of scrollbar thumb */
+.ScrollbarThumbBottom {
+ position: absolute;
+ background: url("ScrollbarThumbBottom.png") no-repeat;
+ width: 7px;
+ height: 5px;
+}
+
+
+/******************************************************************************/
+/* NotificationPopup */
+
+/* Container that defines the area for the popup dialog */
+.NotificationPopupContainer {
+ position: fixed;
+ bottom: 0px;
+ left: 50%;
+ margin-left: -115px;
+ width: 230px;
+ height: 85px;
+}
+
+/* Notification popup dialog */
+.NotificationPopup {
+ position: absolute;
+ width: 230px;
+ height: 85px;
+ background: url("NotificationPopupBackground.png") repeat-x;
+ border: 1px solid rgb(0,0,0);
+}
+
+/* Notification type indicator */
+.NotificationPopupTypeIndicator {
+ position: absolute;
+ left: 195px;
+ top: 10px;
+ width: 24px;
+ height: 34px;
+ background: url("NotificationPopupTypeIndicator.png") no-repeat;
+}
+
+/* Notification type indicator for notifications of undefined type */
+.NotificationPopupTypeIndicatorNone {
+ background-position: 0px 0px;
+}
+
+/* Notification type indicator for info notifications */
+.NotificationPopupTypeIndicatorInfo {
+ background-position: 0px -50px;
+}
+
+/* Notification type indicator for warning notifications */
+.NotificationPopupTypeIndicatorWarning {
+ background-position: 0px -100px;
+}
+
+/* Notification type indicator for wait notifications */
+.NotificationPopupTypeIndicatorWait {
+ background-position: 0px -150px;
+}
+
+/* Notification text area */
+.NotificationPopupText {
+ position: absolute;
+ left: 10px;
+ top: 8px;
+ width: 180px;
+ height: 50px;
+}
+
+/* Progress bar */
+.NotificationPopupProgressBar {
+ position: absolute;
+ left: 6px;
+ top: 60px;
+ width: 218px;
+ height: 16px;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/ActionControl.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,144 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (ÒNokiaÓ) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under NokiaÕs copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The ActionControl class is an abstract base class for action controls like
+// buttons. Don't use ActionControl directly.
+
+// Constructor.
+function ActionControl(id, caption) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption);
+ }
+}
+
+// ActionControl inherits from Control.
+ActionControl.prototype = new Control(UI_NO_INIT_ID);
+
+// Reference to the button element.
+ActionControl.prototype.buttonElement = null;
+
+// Reference to the link element.
+ActionControl.prototype.linkElement = null;
+
+// Enabled status.
+ActionControl.prototype.enabled = false;
+
+// Initializer - called from constructor.
+ActionControl.prototype.init = function(id, caption) {
+ uiLogger.debug("ActionControl.init(" + id + ", " + caption + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, caption);
+
+ // the control defaults to enabled
+ this.enabled = true;
+}
+
+// Common event listeners hookup function called from subclasses.
+ActionControl.prototype.bindActionControlListeners = function() {
+ var self = this;
+ this.linkElement.addEventListener("focus", function() { self.focusStateChanged(true); }, false);
+ this.linkElement.addEventListener("blur", function() { self.focusStateChanged(false); }, false);
+ this.buttonElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
+ this.buttonElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
+ this.buttonElement.addEventListener("mousedown", function(event) {
+ self.controlClicked(event);
+ event.stopPropagation();
+ event.preventDefault();
+ }, true);
+ this.buttonElement.addEventListener("keydown", function(event) {
+ // center and enter trigger the action
+ if (event.keyCode == 0 || event.keyCode == 13) {
+ self.controlClicked();
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ }, true);
+}
+
+// Returns the enabled state.
+ActionControl.prototype.isEnabled = function() {
+ return this.enabled;
+}
+
+// Sets the enabled state.
+ActionControl.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("ActionControl.setEnabled(" + enabled + ")");
+ // switch the state
+ this.enabled = enabled;
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+ActionControl.prototype.setFocused = function(focused) {
+ uiLogger.debug("ActionControl.setFocused(" + focused + ")");
+ if (this.enabled) {
+ if (focused) {
+ this.linkElement.focus();
+ } else {
+ this.linkElement.blur();
+ }
+ }
+}
+
+// Callback for clicks.
+ActionControl.prototype.controlClicked = function(event) {
+ uiLogger.debug("ActionControl.controlClicked()");
+
+ // if we're enabled then a click results in an action performed event
+ if (this.enabled) {
+ // focus when clicked
+ if (!this.focused) {
+ this.linkElement.focus();
+ }
+
+ // notify event listeners
+ this.actionPerformed(event);
+ }
+}
+
+// Callback for action performed events.
+ActionControl.prototype.actionPerformed = function(event) {
+ uiLogger.debug("ActionControl.actionPerformed()");
+ // notify event listeners
+ this.fireEvent(this.createEvent("ActionPerformed", event));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/Ajax.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,103 @@
+/*
+� Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (�Nokia�) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia�s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Ajax utility calss to create XmlHttpRequest object
+function Ajax()
+{
+ // xmlHttpRequest object
+ var request = null;
+
+ // branch for native XMLHttpRequest object
+ if(window.XMLHttpRequest && !(window.ActiveXObject)) {
+ try
+ {
+ request = new XMLHttpRequest();
+ try
+ {
+ // attach the Bypass code, if the browser is firefox
+ if(netscape.security.PrivilegeManager.enablePrivilege)
+ {
+ // duplicate the function
+ request._open = request.open;
+
+ // redefine the function definition
+ request.open = function(method, url, flag)
+ {
+ try
+ {
+ // Enable Universal Browser Read
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+
+ // call the native XmlHttpRequest.open method
+ this._open(method, url, flag);
+ }catch(e)
+ {
+ // call the native XmlHttpRequest.open method
+ this._open(method, url, flag);
+ }
+ }
+ }
+ }
+ catch(e)
+ {
+ // eatup all exceptions
+ }
+ }
+ catch(e) {
+ request = null;
+ }
+ // branch for IE/Windows ActiveX version
+ } else if(window.ActiveXObject) {
+ try {
+ request = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch(e) {
+ try {
+ request = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch(e) {
+ alert('Failed to create XmlHttprequest');
+ return null;
+ }
+ }
+ }
+
+ return (request);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/ContentPanel.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,367 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The ContentPanel class is a control for displaying content. The panel
+// can be expanded and collapsed.
+
+// Constructor.
+function ContentPanel(id, caption, content, foldable, expanded) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, content, foldable, expanded);
+ }
+}
+
+// ContentPanel inherits from Control.
+ContentPanel.prototype = new Control(UI_NO_INIT_ID);
+
+// The element hierarchy in a content panel is as follows:
+//
+// rootElement
+// assemblyElement
+// captionElement
+// foldToggleElement
+// captionLinkElement
+// captionTextElement
+// contentElement
+//
+// captionTextElement is moved under foldToggleElement if disabled
+// or captionElement if not foldable
+
+// The fold toggle element used for folding content panels.
+ContentPanel.prototype.foldToggleElement = null;
+
+// The caption link element of this control.
+ContentPanel.prototype.captionLinkElement = null;
+
+// The caption text element of this control.
+ContentPanel.prototype.captionTextElement = null;
+
+// The content element of this control.
+ContentPanel.prototype.contentElement = null;
+
+// The foldable state of this control.
+ContentPanel.prototype.foldable = false;
+
+// The expanded state of this control.
+ContentPanel.prototype.expanded = false;
+
+// Enabled status.
+ContentPanel.prototype.enabled = false;
+
+// Initializer - called from constructor.
+ContentPanel.prototype.init = function(id, caption, content, foldable, expanded) {
+ uiLogger.debug("ContentPanel.init(" + id + ", " + caption + ", " + content + ", " + foldable + ", " + expanded + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, caption);
+
+ // the control defaults to enabled
+ this.enabled = true;
+
+ // create caption text element
+ this.captionTextElement = document.createElement("span");
+
+ // disconnect the control element
+ this.assemblyElement.removeChild(this.controlElement);
+
+ // set the foldable state
+ this.foldable = foldable;
+
+ // is this a foldable content panel?
+ if (foldable) {
+ // create fold toggle element
+ this.foldToggleElement = document.createElement("div");
+ this.captionElement.appendChild(this.foldToggleElement);
+
+ // create caption link and add to caption element
+ this.captionLinkElement = document.createElement("a");
+ this.captionLinkElement.href = "JavaScript:void(0)";
+ this.foldToggleElement.appendChild(this.captionLinkElement);
+
+ // add the text element to the link element
+ this.captionLinkElement.appendChild(this.captionTextElement);
+
+ // bind event listeners
+ var self = this;
+ this.captionLinkElement.addEventListener("focus", function() { self.focusStateChanged(true); }, false);
+ this.captionLinkElement.addEventListener("blur", function() { self.focusStateChanged(false); }, false);
+ this.foldToggleElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
+ this.foldToggleElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
+ this.foldToggleElement.addEventListener("mousedown", function(event) {
+ self.captionClicked();
+ event.stopPropagation();
+ event.preventDefault();
+ }, true);
+ this.foldToggleElement.addEventListener("keydown", function(event) {
+ // center and enter trigger the action
+ if (event.keyCode == 0 || event.keyCode == 13) {
+ self.captionClicked();
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ }, true);
+
+ this.expanded = expanded;
+ } else {
+ // since this is not a foldable panel the content should be expanded
+ this.expanded = true;
+
+ // add the text element directly to the caption element
+ this.captionElement.appendChild(this.captionTextElement);
+ }
+
+ // create content element
+ this.contentElement = document.createElement("div");
+ this.contentElement.style.display = this.expanded ? "block" : "none";
+ this.rootElement.appendChild(this.contentElement);
+
+ // set caption, content and expanded state
+ this.setCaption(caption);
+ this.setContent(content);
+
+ // update style
+ this.updateStyleFromState();
+}
+
+// Returns the enabled state.
+ContentPanel.prototype.isEnabled = function() {
+ return this.enabled;
+}
+
+// Sets the enabled state.
+ContentPanel.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("ContentPanel.setEnabled(" + enabled + ")");
+
+ // bail out early if there is no change in state
+ if (this.enabled == enabled) {
+ return;
+ }
+
+ // set the enabled state
+ this.enabled = enabled;
+
+ // is this a foldable content?
+ if (this.foldable) {
+ // the caption link must be disabled
+ if (this.enabled) {
+ // diabled -> enabled
+ this.foldToggleElement.removeChild(this.captionTextElement);
+ this.foldToggleElement.appendChild(this.captionLinkElement);
+ this.captionLinkElement.appendChild(this.captionTextElement);
+ } else {
+ // enabled -> diabled
+ this.captionLinkElement.removeChild(this.captionTextElement);
+ this.foldToggleElement.removeChild(this.captionLinkElement);
+ this.foldToggleElement.appendChild(this.captionTextElement);
+ }
+ }
+
+ // update style
+ this.updateStyleFromState();
+}
+
+// Returns the caption; null if none.
+ContentPanel.prototype.getCaption = function() {
+ return this.caption;
+}
+
+// Sets the caption; null if none.
+ContentPanel.prototype.setCaption = function(caption) {
+ // bail out if the caption text element has not been created
+ // this is to prevent the superclass init calling this before
+ // we've initialized our custom caption
+ if (this.captionTextElement == null)
+ return;
+
+ uiLogger.debug("ContentPanel.setCaption(" + caption + ")");
+
+ // set the display style
+ this.captionElement.style.display = (caption == null) ? "none" : "block";
+
+ // set the caption
+ this.caption = caption;
+ this.captionTextElement.innerHTML = (caption == null) ? "" : caption;
+
+ // update style
+ this.updateStyleFromState();
+}
+
+// Returns the content.
+ContentPanel.prototype.getContent = function() {
+ return this.contentElement.innerHTML;
+}
+
+// Sets the content.
+ContentPanel.prototype.setContent = function(content) {
+ uiLogger.debug("ContentPanel.setContent(" + content + ")");
+ this.contentElement.innerHTML = (content == null) ? "" : content;
+}
+
+// Returns the focusable state for the control.
+ContentPanel.prototype.isFocusable = function() {
+ // a content panel is focusable if it's foldable and enabled
+ return (this.foldable && this.enabled);
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+ContentPanel.prototype.setFocused = function(focused) {
+ uiLogger.debug("ContentPanel.setFocused(" + focused + ")");
+ if (this.enabled && this.foldable) {
+ if (focused) {
+ this.captionLinkElement.focus();
+ } else {
+ this.captionLinkElement.blur();
+ }
+ }
+ // note that this.focused gets set as a result of focusStateChanged() being called
+ // rather than setting it explicitly here
+}
+
+// Returns the expanded state.
+ContentPanel.prototype.isExpanded = function() {
+ return this.expanded;
+}
+
+// Sets the expanded state.
+ContentPanel.prototype.setExpanded = function(expanded) {
+ uiLogger.debug("ContentPanel.setExpanded(" + expanded + ")");
+
+ // make sure only foldable content panels are folded
+ if (!this.foldable) {
+ uiLogger.warn("Cannot fold a non-foldable content panel!");
+ return;
+ }
+
+ this.expanded = expanded;
+ if (this.expanded) {
+ // expand
+ this.contentElement.style.display = "block";
+
+ // find out control top and bottom
+ var controlTop = this.getAbsoluteTop(this.rootElement);
+ var controlHeight = this.rootElement.clientHeight;
+ var controlBottom = controlTop + controlHeight;
+
+ // find out the viewport top and bottom
+ var viewportTop = window.scrollY;
+ var viewportHeight = window.innerHeight;
+ var viewportBottom = viewportTop + viewportHeight;
+
+ // make sure the control is positioned so that it can be seen
+ var overflow = controlBottom - viewportBottom;
+ if (overflow > 0) {
+ // there's overflow so we need to scroll to get the control
+ // into the viewport - however not so far that the control
+ // goes past the viewport top.
+ var distanceToTop = controlTop - viewportTop;
+ var scrollAmount = Math.min(overflow, distanceToTop);
+ window.scrollBy(0, scrollAmount);
+ }
+ } else {
+ // collapse
+ this.contentElement.style.display = "none";
+ }
+
+ // notify event listeners
+ this.fireEvent(this.createEvent("ExpandedStateChanged", this.expanded));
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Returns the absolute position (y) of the given element.
+ContentPanel.prototype.getAbsoluteTop = function(element) {
+ // traverse from element to root and add top-offset
+ // for each element we find on the way
+ var absTop = 0;
+ while (element != null) {
+ absTop += element.offsetTop;
+ element = element.offsetParent;
+ }
+ return absTop;
+}
+
+// Callback for when the caption is clicked.
+ContentPanel.prototype.captionClicked = function() {
+ uiLogger.debug("ContentPanel.captionClicked()");
+
+ // if we're enabled then a click results toggling the expanded state
+ if (this.enabled) {
+ // focus when clicked
+ if (!this.focused) {
+ this.captionLinkElement.focus();
+ }
+
+ // toggle the expanded state
+ this.setExpanded(!this.expanded);
+ }
+}
+
+// Updates the style of the control to reflects the state of the control.
+ContentPanel.prototype.updateStyleFromState = function() {
+ uiLogger.debug("ContentPanel.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set root element class name
+ this.setClassName(this.rootElement, "Control");
+
+ // set the control assembly class names
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+
+ if (this.foldable) {
+ // foldable content panel
+ this.setClassName(this.captionElement, "ContentPanelCaptionFoldable");
+ this.setClassName(this.foldToggleElement, "ContentPanelFoldToggle ContentPanelFoldToggle" + (this.expanded ? "Expanded" : "Collapsed"));
+ } else {
+ // non-folding
+ this.setClassName(this.captionElement, "ContentPanelCaptionNonFoldable");
+ }
+
+ // set the content caption text class names
+ this.setClassName(this.captionTextElement, "ContentPanelCaptionText ContentPanelCaptionText" + stateName);
+
+ // set the content element class names
+ this.setClassName(this.contentElement, "ContentPanelContent");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/Control.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,231 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The Control class is an abstract base class for all user interface controls.
+
+// Constructor.
+function Control(id, caption) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption);
+ }
+}
+
+// Control inherits from UIElement.
+Control.prototype = new UIElement(UI_NO_INIT_ID);
+
+// The view that control belongs to.
+Control.prototype.view = null;
+
+// Is the control focused?
+Control.prototype.focused = false;
+
+// Is the pointer over this control?
+Control.prototype.hovering = false;
+
+// The element hierarchy in a control is as follows:
+//
+// rootElement
+// assemblyElement
+// captionElement
+// controlElement
+//
+// The assembly element groups the portion of a control that typically handle
+// the visual effects for focus and hover states. Having a separate root and
+// assembly elements allows other elements to be added to a control without
+// them being affected by the CSS rules of the assembly element.
+
+// The assembly element of this control.
+Control.prototype.assemblyElement = null;
+
+// The caption of this control; null if none.
+Control.prototype.caption = null;
+
+// The caption element of this control.
+Control.prototype.captionElement = null;
+
+// The control element of this control.
+Control.prototype.controlElement = null;
+
+// Initializer - called from constructor.
+Control.prototype.init = function(id, caption) {
+ uiLogger.debug("Control.init(" + id + ", " + caption + ")");
+
+ // call superclass initializer
+ UIElement.prototype.init.call(this, id);
+
+ // create assembly, caption and control elements
+ this.assemblyElement = document.createElement("div");
+ this.captionElement = document.createElement("div");
+ this.assemblyElement.appendChild(this.captionElement);
+ this.controlElement = document.createElement("div");
+ this.assemblyElement.appendChild(this.controlElement);
+ this.rootElement.appendChild(this.assemblyElement);
+
+ // set the caption
+ // style is not updated because the subclass will update the style later
+ // when it has completely initialized the component
+ this.setCaption(caption, true);
+}
+
+// Returns the caption; null if none.
+Control.prototype.getCaption = function() {
+ return this.caption;
+}
+
+// Sets the caption; null if none.
+Control.prototype.setCaption = function(caption, noStyleUpdate) {
+ uiLogger.debug("Control.setCaption(" + caption + ")");
+
+ // set the display style
+ this.captionElement.style.display = (caption == null) ? "none" : "block";
+
+ // set the caption
+ this.caption = caption;
+ this.captionElement.innerHTML = (caption == null) ? "" : caption;
+
+ // update style
+ if (!noStyleUpdate) {
+ this.updateStyleFromState();
+ }
+}
+
+// Returns the enabled state.
+// Override this in subclasses as required to implement the state change.
+Control.prototype.isEnabled = function() {
+ return false;
+}
+
+// Sets the enabled state.
+// Override this in subclasses as required to implement the state change.
+Control.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("Control.setEnabled(" + enabled + ")");
+}
+
+// Returns the focusable state for the control.
+// Defaults focusable if enabled - override this in subclasses as required.
+Control.prototype.isFocusable = function() {
+ return this.isEnabled();
+}
+
+// Returns the focused state for the control.
+Control.prototype.isFocused = function() {
+ return this.focused;
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+// Override this in subclasses as required to implement the state change.
+Control.prototype.setFocused = function(focused) {
+ uiLogger.debug("Control.setFocused(" + focused + ")");
+ // note that this.focused gets set as a result of focusStateChanged() being called
+ // rather than setting it explicitly here
+}
+
+// Called when the focus state has changed for this control.
+Control.prototype.focusStateChanged = function(focused) {
+ uiLogger.debug("Control.focusStateChanged(" + focused + ")");
+ if (this.focused != focused) {
+ this.focused = focused;
+
+ // let the view know about the focus change
+ if (this.view != null) {
+ this.view.focusedControlChanged(focused ? this : null);
+ }
+
+ // update the style from the current state
+ this.updateStyleFromState();
+
+ // notify event listeners
+ this.fireEvent(this.createEvent("FocusStateChanged", focused));
+ }
+}
+
+// Called when the hover state has changed for this control.
+Control.prototype.hoverStateChanged = function(hovering) {
+ uiLogger.debug("Control.hoverStateChanged(" + hovering + ")");
+ if (this.hovering != hovering) {
+ this.hovering = hovering;
+
+ // update the style from the current state
+ this.updateStyleFromState();
+
+ // notify event listeners
+ this.fireEvent(this.createEvent("HoverStateChanged", hovering));
+ }
+}
+
+// Helper method that returns the state name for the current state.
+Control.prototype.getStyleStateName = function() {
+ var focusable = this.isFocusable();
+ if (focusable && this.focused) {
+ return "Focus";
+ } else if (focusable && this.hovering) {
+ return "Hover";
+ } else if (!this.isEnabled()) {
+ return "Disabled";
+ } else {
+ return "Normal";
+ }
+}
+
+// Resets the state tracking for focus and hover.
+// Override this in subclasses as required to implement the state reset.
+Control.prototype.resetFocusState = function() {
+ uiLogger.debug("Control.resetFocusState()");
+ this.hovering = false;
+ this.focused = false;
+ this.updateStyleFromState();
+}
+
+// Helper function that sets a classname for an element.
+// Only sets the class name if it actually is different from the current value.
+Control.prototype.setClassName = function(element, className) {
+ if (element.className != className) {
+ element.className = className;
+ }
+}
+
+// Updates the style of the control to reflects the state of the control.
+// Override this in subclasses as required to implement the state change.
+Control.prototype.updateStyleFromState = function() {
+ uiLogger.debug("Control.updateStyleFromState()");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/FormButton.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,177 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The FormButton class implements a button control for use in form-style UIs.
+
+// Constructor.
+function FormButton(id, text) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, text);
+ }
+}
+
+// FormButton inherits from ActionControl.
+FormButton.prototype = new ActionControl(UI_NO_INIT_ID);
+
+// Button table element.
+FormButton.prototype.tableElement = null;
+
+// Button table row element.
+FormButton.prototype.tableRowElement = null;
+
+// Button table left cell element.
+FormButton.prototype.tableLeftCellElement = null;
+
+// Button table center cell element.
+FormButton.prototype.tableCenterCellElement = null;
+
+// Button text element.
+FormButton.prototype.textElement = null;
+
+// Button table right cell element.
+FormButton.prototype.tableRightCellElement = null;
+
+// Initializer - called from constructor.
+FormButton.prototype.init = function(id, text) {
+ uiLogger.debug("FormButton.init(" + id + ", " + text + ")");
+
+ // call superclass initializer
+ ActionControl.prototype.init.call(this, id, null);
+
+ // remove caption element
+ this.assemblyElement.removeChild(this.captionElement);
+
+ // construct the button
+ this.buttonElement = document.createElement("div");
+ this.tableElement = document.createElement("table");
+ this.tableRowElement = document.createElement("tr");
+ this.tableLeftCellElement = document.createElement("td");
+ this.tableCenterCellElement = document.createElement("td");
+ this.linkElement = document.createElement("a");
+ this.linkElement.href = "JavaScript:void(0)";
+ this.textElement = document.createElement("span");
+ this.tableRightCellElement = document.createElement("td");
+ this.tableElement.appendChild(this.tableRowElement);
+ this.tableRowElement.appendChild(this.tableLeftCellElement);
+ this.tableRowElement.appendChild(this.tableCenterCellElement);
+ this.tableCenterCellElement.appendChild(this.linkElement);
+ this.linkElement.appendChild(this.textElement);
+ this.tableRowElement.appendChild(this.tableRightCellElement);
+ this.buttonElement.appendChild(this.tableElement);
+ this.controlElement.appendChild(this.buttonElement);
+
+ // set the text
+ this.setText(text);
+
+ // bind event listeners
+ this.bindActionControlListeners();
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Sets the enabled state.
+FormButton.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("FormButton.setEnabled(" + enabled + ")");
+
+ // bail out early if there is no change in state
+ if (this.enabled == enabled) {
+ return;
+ }
+
+ // set the enabled state
+ this.enabled = enabled;
+
+ if (this.enabled) {
+ // diabled -> enabled
+ this.tableCenterCellElement.removeChild(this.textElement);
+ this.tableCenterCellElement.appendChild(this.linkElement);
+ this.linkElement.appendChild(this.textElement);
+ } else {
+ // enabled -> diabled
+ this.linkElement.removeChild(this.textElement);
+ this.tableCenterCellElement.removeChild(this.linkElement);
+ this.tableCenterCellElement.appendChild(this.textElement);
+ }
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Returns the button text.
+FormButton.prototype.getText = function() {
+ return this.textElement.innerHTML;
+}
+
+// Sets the button text.
+FormButton.prototype.setText = function(text) {
+ uiLogger.debug("FormButton.setText(" + text + ")");
+ this.textElement.innerHTML = (text == null) ? "" : text;;
+}
+
+// Updates the style of the control to reflects the state of the control.
+FormButton.prototype.updateStyleFromState = function() {
+ uiLogger.debug("FormButton.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set root element class name
+ this.setClassName(this.rootElement, "Control");
+
+ // set the control assembly class names
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal");
+
+ // control element
+ this.setClassName(this.controlElement, "ControlElement FormButtonControlElement");
+
+ // set the button table class names
+ this.setClassName(this.buttonElement, "FormButton");
+ this.setClassName(this.tableElement, "FormButtonTable");
+ this.setClassName(this.tableRowElement, "FormButtonRow");
+ this.setClassName(this.tableLeftCellElement, "FormButtonLeftCell FormButtonLeftCell" + stateName);
+ this.setClassName(this.tableCenterCellElement, "FormButtonCenterCell FormButtonLeftCell" + stateName);
+ this.setClassName(this.tableRightCellElement, "FormButtonRightCell FormButtonLeftCell" + stateName);
+
+ // set the button text class name
+ this.setClassName(this.textElement, "FormButtonText FormButtonText" + stateName);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/Label.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,105 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The Label class implements a control that displays textual content.
+
+// Constructor.
+function Label(id, caption, text) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, text);
+ }
+}
+
+// Label inherits from Control.
+Label.prototype = new Control(UI_NO_INIT_ID);
+
+// Content element for label text.
+Label.prototype.contentElement = null;
+
+// Initializer - called from constructor.
+Label.prototype.init = function(id, caption, text) {
+ uiLogger.debug("Label.init(" + id + ", " + caption + ", " + text + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, caption);
+
+ // create content element
+ this.contentElement = document.createElement("div");
+ this.controlElement.appendChild(this.contentElement);
+
+ // set the text
+ this.setText(text);
+}
+
+// Returns the enabled state for the control.
+Label.prototype.isEnabled = function() {
+ return true;
+}
+
+// Returns the focusable state for the control.
+Label.prototype.isFocusable = function() {
+ return false;
+}
+
+// Returns the control text.
+Label.prototype.getText = function() {
+ return this.contentElement.innerHTML;
+}
+
+// Sets the text for the control.
+Label.prototype.setText = function(text) {
+ uiLogger.debug("Label.setText(" + text + ")");
+ this.contentElement.innerHTML = (text == null) ? "" : text;
+ this.updateStyleFromState();
+}
+
+// Updates the style of the control to reflects the state of the control.
+Label.prototype.updateStyleFromState = function() {
+ uiLogger.debug("Label.updateStyleFromState()");
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal");
+ this.setClassName(this.captionElement, "ControlCaption ControlCaptionNormal");
+ this.setClassName(this.controlElement, "ControlElement");
+ this.setClassName(this.contentElement, "LabelText");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/ListView.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,189 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The ListView class implements a vertical list view that hosts controls
+// as child components.
+
+// Constructor.
+function ListView(id, caption) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption);
+ }
+}
+
+// ListView inherits from View.
+ListView.prototype = new View(UI_NO_INIT_ID);
+
+// The caption of this view; null if none.
+ListView.prototype.caption = null;
+
+// The caption element of this view.
+ListView.prototype.captionElement = null;
+
+// The caption text element of this view.
+ListView.prototype.captionTextElement = null;
+
+// Root HTML element for controls.
+ListView.prototype.listElement = null;
+
+// List of controls in the view.
+ListView.prototype.controls = null;
+
+// Initializer for ListView.
+ListView.prototype.init = function(id, caption) {
+ uiLogger.debug("ListView.init(" + id + ", " + caption + ")");
+
+ // call superclass initializer
+ View.prototype.init.call(this, id);
+
+ // init control array
+ this.controls = [];
+
+ // set style class name for root element
+ this.rootElement.className = "ListView";
+
+ // create caption and caption text elements
+ this.captionElement = document.createElement("div");
+ this.captionElement.className = "ListViewCaption";
+ this.captionTextElement = document.createElement("div");
+ this.captionTextElement.className = "ListViewCaptionText";
+ this.captionElement.appendChild(this.captionTextElement);
+ this.rootElement.appendChild(this.captionElement);
+
+ // create root element for controls and add to the view root element
+ this.listElement = document.createElement("div");
+ this.listElement.className = "ListViewControlList";
+ this.rootElement.appendChild(this.listElement);
+
+ // set the caption
+ this.setCaption(caption);
+}
+
+// Returns the caption; null if none.
+ListView.prototype.getCaption = function() {
+ return this.caption;
+}
+
+// Sets the caption; null if none.
+ListView.prototype.setCaption = function(caption) {
+ uiLogger.debug("ListView.setCaption(" + caption + ")");
+
+ // set the display style
+ this.captionElement.style.display = (caption == null) ? "none" : "block";
+
+ // set the caption
+ this.caption = caption;
+ this.captionTextElement.innerHTML = (caption == null) ? "" : caption;
+}
+
+// Returns an array of controls in the view.
+ListView.prototype.getControls = function() {
+ return this.controls;
+}
+
+// Adds a control to the view.
+ListView.prototype.addControl = function(control) {
+ uiLogger.debug("ListView.addControl(" + control + ")");
+
+ // add the control to the controls array and attach it to the list element
+ this.controls.push(control);
+ this.listElement.appendChild(control.rootElement);
+ control.view = this;
+}
+
+// Inserts a control to the view before the specified control.
+ListView.prototype.insertControl = function(control, beforeControl) {
+ uiLogger.debug("ListView.insertControl(" + control + ", " + beforeControl + ")");
+
+ // iterate through current controls
+ for (var i = 0; i < this.controls.length; i++) {
+ // is this the control we should insert before?
+ if (this.controls[i] == beforeControl) {
+ // we found the control to insert before - insert here and connect to list element
+ this.controls.splice(i, 0, control);
+ this.listElement.insertBefore(control.rootElement, beforeControl.rootElement);
+ control.view = this;
+ return;
+ }
+ }
+
+ // the control wasn't found so we'll add it last
+ this.addControl(control);
+}
+
+// Removes a control from the view.
+ListView.prototype.removeControl = function(control) {
+ uiLogger.debug("ListView.removeControl(" + control + ")");
+
+ // iterate through current controls
+ for (var i = 0; i < this.controls.length; i++) {
+ // is this the control we should remove?
+ if (this.controls[i] == control) {
+ // we found the control to remove - remove it from the list element
+ this.controls.splice(i, 1);
+ this.listElement.removeChild(control.rootElement);
+ control.view = null;
+ }
+ }
+}
+
+// Attempts to focus the first focusable control.
+ListView.prototype.focusFirstControl = function() {
+ uiLogger.debug("ListView.focusFirstControl()");
+ for (var i = 0; i < this.controls.length; i++) {
+ // is this control focusable?
+ var control = this.controls[i];
+ if (control.isFocusable()) {
+ control.setFocused(true);
+ break;
+ }
+ }
+}
+
+// Attempts to reset all control focus states.
+// Override in subclasses as required.
+ListView.prototype.resetControlFocusStates = function() {
+ uiLogger.debug("ListView.resetControlFocusStates()");
+ for (var i = 0; i < this.controls.length; i++) {
+ this.controls[i].resetFocusState();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/NavigationButton.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,220 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The NavigationButton class implements a button control for use in
+// navigational contexts in menu-style UIs.
+
+// Constructor.
+function NavigationButton(id, image, text) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, image, text);
+ }
+}
+
+// NavigationButton inherits from ActionControl.
+NavigationButton.prototype = new ActionControl(UI_NO_INIT_ID);
+
+// Button table element.
+NavigationButton.prototype.tableElement = null;
+
+// Button table row element.
+NavigationButton.prototype.tableRowElement = null;
+
+// Button table left cell element.
+NavigationButton.prototype.tableLeftCellElement = null;
+
+// Button table right cell element.
+NavigationButton.prototype.tableRightCellElement = null;
+
+// Button image element.
+NavigationButton.prototype.imageElement = null;
+
+// Button link element.
+NavigationButton.prototype.linkElement = null;
+
+// Button text element.
+NavigationButton.prototype.textElement = null;
+
+// Initializer - called from constructor.
+NavigationButton.prototype.init = function(id, image, text) {
+ uiLogger.debug("NavigationButton.init(" + id + ", " + image + ", " + text + ")");
+
+ // call superclass initializer
+ ActionControl.prototype.init.call(this, id, null);
+
+ // remove caption element
+ this.assemblyElement.removeChild(this.captionElement);
+
+ // construct the button
+ this.buttonElement = document.createElement("div");
+ this.tableElement = document.createElement("table");
+ this.tableRowElement = document.createElement("tr");
+ this.tableLeftCellElement = document.createElement("td");
+ this.tableRightCellElement = document.createElement("td");
+ this.imageElement = null;
+ this.linkElement = document.createElement("a");
+ this.linkElement.href = "JavaScript:void(0)";
+ this.textElement = document.createElement("span");
+ this.tableElement.appendChild(this.tableRowElement);
+ this.tableRowElement.appendChild(this.tableLeftCellElement);
+ this.tableRowElement.appendChild(this.tableRightCellElement);
+ this.tableRightCellElement.appendChild(this.linkElement);
+ this.linkElement.appendChild(this.textElement);
+ this.buttonElement.appendChild(this.tableElement);
+ this.controlElement.appendChild(this.buttonElement);
+
+ // set the image and text
+ this.setImage(image);
+ this.setText(text);
+
+ // bind event listeners
+ this.bindActionControlListeners();
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Sets the enabled state.
+NavigationButton.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("NavigationButton.setEnabled(" + enabled + ")");
+
+ // bail out early if there is no change in state
+ if (this.enabled == enabled) {
+ return;
+ }
+
+ // set the enabled state
+ this.enabled = enabled;
+
+ if (this.enabled) {
+ // diabled -> enabled
+ this.tableRightCellElement.removeChild(this.textElement);
+ this.tableRightCellElement.appendChild(this.linkElement);
+ this.linkElement.appendChild(this.textElement);
+ } else {
+ // enabled -> diabled
+ this.linkElement.removeChild(this.textElement);
+ this.tableRightCellElement.removeChild(this.linkElement);
+ this.tableRightCellElement.appendChild(this.textElement);
+ }
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Returns the button image (URL); null if none.
+NavigationButton.prototype.getImage = function() {
+ return (this.imageElement != null) ? this.imageElement.src : null;
+}
+
+// Sets the button image (URL); null if none.
+NavigationButton.prototype.setImage = function(image) {
+ uiLogger.debug("NavigationButton.setImage(" + image + ")");
+
+ if (image == null) {
+ // remove image - if any
+ if (this.imageElement != null) {
+ this.tableLeftCellElement.removeChild(this.imageElement);
+ }
+ } else {
+ // default to not append image element
+ var append = false;
+
+ // create image element if one doesn't exist
+ if (this.imageElement == null) {
+ this.imageElement = document.createElement("img");
+ this.imageElement.setAttribute("alt", "");
+ append = true;
+ }
+
+ // set image source URL
+ this.imageElement.src = image;
+
+ // append the image element to the left cell?
+ if (append) {
+ this.tableLeftCellElement.appendChild(this.imageElement);
+ }
+ }
+}
+
+// Returns the button text.
+NavigationButton.prototype.getText = function() {
+ return this.textElement.innerHTML;
+}
+
+// Sets the button text.
+NavigationButton.prototype.setText = function(text) {
+ uiLogger.debug("NavigationButton.setText(" + text + ")");
+ this.textElement.innerHTML = (text == null) ? "" : text;;
+}
+
+// Updates the style of the control to reflects the state of the control.
+NavigationButton.prototype.updateStyleFromState = function() {
+ uiLogger.debug("NavigationButton.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set root element class name
+ this.setClassName(this.rootElement, "Control");
+
+ // set the control assembly class names
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+
+ // control element
+ this.setClassName(this.controlElement, "ControlElement NavigationButtonControlElement");
+
+ // set the button table class names
+ this.setClassName(this.buttonElement, "NavigationButton");
+ this.setClassName(this.tableElement, "NavigationButtonTable");
+ this.setClassName(this.tableRowElement, "NavigationButtonRow");
+ this.setClassName(this.tableLeftCellElement, "NavigationButtonImageCell");
+ this.setClassName(this.tableRightCellElement, "NavigationButtonTextCell");
+
+ // set image class names
+ if (this.imageElement) {
+ this.setClassName(this.imageElement, "NavigationButtonImage");
+ }
+
+ // set the button text class name
+ this.setClassName(this.textElement, "NavigationButtonText NavigationButtonText" + stateName);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/NotificationPopup.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,330 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The NotificationPopup class handles the display of notifications such as
+// warnings, information messages and progress indication.
+
+// Constructor.
+function NotificationPopup() {
+ // create notification popup
+ this.containerElement = document.createElement("div");
+ this.containerElement.className = "NotificationPopupContainer";
+ this.popupElement = document.createElement("div");
+ this.popupElement.className = "NotificationPopup";
+ this.typeIndicatorElement = document.createElement("div");
+ this.typeIndicatorElement.className = "NotificationPopupTypeIndicator";
+ this.textElement = document.createElement("div");
+ this.textElement.className = "NotificationPopupText";
+ this.progressBarElement = document.createElement("div");
+ this.progressBarElement.className = "NotificationPopupProgressBar";
+
+ // assemble popup
+ this.popupElement.appendChild(this.typeIndicatorElement);
+ this.popupElement.appendChild(this.textElement);
+ this.popupElement.appendChild(this.progressBarElement);
+ this.containerElement.appendChild(this.popupElement);
+
+ // create progress bar image element and initialize it
+ this.progressBarImageElement = document.createElement("img");
+ var self = this;
+ this.progressBarImageElement.addEventListener("load", function() { self.progressBarImageLoadingCompleted(); }, false);
+ this.progressBarImageElement.setAttribute("alt", "");
+ this.progressBarImageURL = this.getProgressBarImage(0);
+ this.progressBarImageElement.src = this.progressBarImageURL;
+ this.progressBarElement.appendChild(this.progressBarImageElement);
+
+ // init the popup to be fully down
+ this.popupElement.style.top = "100%";
+
+ // set default popup contents
+ this.setPopupContents(null, null, null);
+}
+
+// Notification container element.
+NotificationPopup.prototype.containerElement = null;
+
+// Notification popup element.
+NotificationPopup.prototype.popupElement = null;
+
+// Type indicator element.
+NotificationPopup.prototype.typeIndicatorElement = null;
+
+// Notification text element.
+NotificationPopup.prototype.textElement = null;
+
+// Progress bar element.
+NotificationPopup.prototype.progressBarElement = null;
+
+// Progress bar image element.
+NotificationPopup.prototype.progressBarImageElement = null;
+
+// Progress bar image URL.
+NotificationPopup.prototype.progressBarImageURL = null;
+
+// Has the progress bar image been loaded?
+NotificationPopup.prototype.progressBarImageLoaded = false;
+
+// Flag that tracks whether we're in the middle of starting to
+// show a notification popup.
+NotificationPopup.prototype.processingShowNotification = false;
+
+// Notification popup position (0 = hidden, 1 = showing).
+NotificationPopup.prototype.popupPosition = 0;
+
+// Interval for timer ticks (in milliseconds)
+NotificationPopup.prototype.ANIM_TIMER_INTERVAL = 25;
+
+// Animation timer identifier or null if no active timer.
+NotificationPopup.prototype.animTimerId = null;
+
+// Time in milliseconds for the popup animation to complete
+NotificationPopup.prototype.ANIM_TIME = 300;
+
+// Flag that determines the behavior of showNotification(). If set to true
+// the popup will snap open when showNotification() is called instead of
+// animation.
+NotificationPopup.prototype.SHOW_SNAPS_OPEN = true;
+
+// Animation direction (0 = no movement, -1 hiding, +1 = showing).
+NotificationPopup.prototype.animDir = 0;
+
+// Auto-hide timer identifier or null if no active timer.
+NotificationPopup.prototype.autoHideTimerId = null;
+
+// The commanded display time.
+NotificationPopup.prototype.displayTime = -1;
+
+// Displays a notification.
+NotificationPopup.prototype.showNotification = function(displayTime, type, text, progress) {
+ uiLogger.debug("NotificationPopup.showNotification(" + displayTime + ", " + type + ", " + text + ", " + progress + ")");
+
+ // mark that showNotification() has been called and that we are in
+ // the middle of starting to show the notification popup
+ this.processingShowNotification = true;
+
+ // remember the display time
+ this.displayTime = displayTime;
+
+ // attach the popup to the document if not attached
+ if (this.containerElement.parentNode == null) {
+ document.body.appendChild(this.containerElement);
+ uiLogger.debug("Notification popup attached to document");
+ }
+
+ // set popup contents and update style
+ this.setPopupContents(type, text, progress);
+
+ // if the progress image is loaded then we can complete the showing
+ // of the notification popup immediately - otherwise the image loaded
+ // allback will complete the process.
+ if (this.progressBarImageLoaded) {
+ this.completeShowNotification();
+ }
+}
+
+// Completes displaying of a notification.
+// Note: Used internally - don't call this directly.
+NotificationPopup.prototype.completeShowNotification = function() {
+ uiLogger.debug("NotificationPopup.completeShowNotification()");
+
+ // animation direction is +1 for showing the popup
+ if (this.popupPosition != 1) {
+ if (this.SHOW_SNAPS_OPEN) {
+ if (this.popupPosition == 0) {
+ this.popupPosition = 1;
+ }
+ }
+ this.animatePopup(1);
+ }
+
+ // setup auto hiding if a display time is specified
+ if (this.displayTime > 0) {
+ // stop any existing timer
+ if (this.autoHideTimerId != null) {
+ clearTimeout(this.autoHideTimerId);
+ uiLogger.debug("Auto hide timer stopped");
+ }
+ // set timer to hide notification
+ var self = this;
+ this.autoHideTimerId = setTimeout(function() {
+ if (self.displayTime > 0) {
+ self.hideNotification();
+ }
+ }, this.ANIM_TIME + this.displayTime);
+ uiLogger.debug("Auto hide timer started");
+ }
+
+ // mark us as no longer processing a show notification call
+ this.processingShowNotification = false;
+}
+
+// Hides the currently displayed notification.
+NotificationPopup.prototype.hideNotification = function() {
+ uiLogger.debug("NotificationPopup.hideNotification()");
+ // mark us as no longer processing a show notification call
+ this.processingShowNotification = false;
+
+ // animation direction is -1 for hiding the popup
+ if (this.popupPosition != 0) {
+ this.animatePopup(-1);
+ }
+
+ // stop auto hide timer if one is set
+ if (this.autoHideTimerId != null) {
+ clearTimeout(this.autoHideTimerId);
+ this.autoHideTimerId = null;
+ uiLogger.debug("Auto hide timer stopped");
+ }
+}
+
+// Starts animation of the popup (1 to show, -1 to hide).
+NotificationPopup.prototype.animatePopup = function(direction) {
+ uiLogger.debug("NotificationPopup.animatePopup(" + direction + ")");
+ // set the direction and star the animation timer
+ this.animDir = direction;
+ if (this.animTimerId == null) {
+ var self = this;
+ this.animTimerId = setInterval(function() { self.animate(); }, this.ANIM_TIMER_INTERVAL);
+ uiLogger.debug("Notification popup animation started");
+ }
+}
+
+// Callback for animation timer.
+NotificationPopup.prototype.animate = function() {
+ // calculate new popup position and clamp
+ var animStep = (this.ANIM_TIMER_INTERVAL / this.ANIM_TIME) * this.animDir;
+ var newPos = this.popupPosition + animStep;
+ if (newPos < 0) {
+ newPos = 0;
+ } else if (newPos > 1) {
+ newPos = 1;
+ }
+
+ // set the new position to the popup element
+ this.popupPosition = newPos;
+ this.popupElement.style.top = (100 - Math.round(this.popupPosition * 100)) + "%";
+
+ // have we reached the end of the animation?
+ if (newPos == 0 || newPos == 1) {
+ // reset animation direction
+ this.animDir = 0;
+
+ // remove the popup from the body if its hidden
+ if (newPos == 0) {
+ document.body.removeChild(this.containerElement);
+ uiLogger.debug("Notification popup detached from document");
+ }
+
+ // stop timer
+ clearTimeout(this.animTimerId);
+ this.animTimerId = null;
+ uiLogger.debug("Notification popup animation stopped");
+ }
+}
+
+// Returns a URL for the progress bar image to use for the specified progress.
+NotificationPopup.prototype.getProgressBarImage = function(progress) {
+ // path for progress bar images
+ var progressBarImagePath = "WRTKit/Resources/";
+
+ if (progress < 0) {
+ // unknown progress
+ return progressBarImagePath + "ProgressBarUnknown.gif";
+ } else {
+ // known progress (should be between 0 and 1)
+ var progPct = Math.round(progress * 10) * 10;
+ if (progPct < 0) {
+ progPct = 0;
+ } else if (progPct > 100) {
+ progPct = 100;
+ }
+ return progressBarImagePath + "ProgressBar" + progPct + ".png";
+ }
+}
+
+// Sets the contents of the popup.
+NotificationPopup.prototype.setPopupContents = function(type, text, progress) {
+ uiLogger.debug("NotificationPopup.setPopupContents(" + type + ", " + text + ", " + progress + ")");
+
+ // figure out notification type style name
+ var typeName = (type == null) ? "none" : type.toLowerCase();
+ typeName = typeName.charAt(0).toUpperCase() + typeName.substring(1);
+
+ // set type element class names
+ this.typeIndicatorElement.className = "NotificationPopupTypeIndicator NotificationPopupTypeIndicator" + typeName;
+
+ // set notification text
+ this.textElement.innerHTML = (text == null) ? "" : text;
+
+ // set progress
+ this.progressBarElement.style.display = (progress == null) ? "none" : "block";
+ if (progress != null) {
+ var imgURL = this.getProgressBarImage(progress);
+ if (imgURL != this.progressBarImageURL) {
+ // load new image
+ this.progressBarImageLoaded = false;
+ this.progressBarImageURL = imgURL;
+ this.progressBarImageElement.src = imgURL;
+ } else {
+ // the correct image is already loaded
+ this.progressBarImageLoaded = true;
+ }
+ } else {
+ // there is no progress bar so there is no need
+ // to load any progress bar image
+ this.progressBarImageLoaded = true;
+ }
+}
+
+// Callback for notifying the object that its progress bar image completed loading.
+NotificationPopup.prototype.progressBarImageLoadingCompleted = function() {
+ uiLogger.debug("NotificationPopup.progressBarImageLoadingCompleted()");
+
+ // mark the progress bar image as loaded
+ this.progressBarImageLoaded = true;
+
+ // complete the process of displaying the notification popup
+ // if it has been commanded but not yet completed
+ if (this.processingShowNotification) {
+ this.completeShowNotification();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/Scrollbar.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,173 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The Scrollbar class is an implementation of a user interface element that
+// indicates the current viewport position in a document.
+
+// Constructor.
+function Scrollbar(parentElement) {
+ uiLogger.debug("Scrollbar(" + parentElement + ")");
+
+ // get the parent element
+ this.parentElement = parentElement;
+
+ // create the root element
+ this.rootElement = document.createElement("div");
+ this.rootElement.className = "Scrollbar";
+ this.rootElement.style.visibility = "hidden";
+
+ // create the scrollbar
+ // the scrollbar consists of a root element with six children
+ // (three track elements and three thumb elements)
+
+ // track
+ this.trackTopElement = document.createElement("div");
+ this.trackTopElement.className = "ScrollbarTrackTop";
+ this.trackMiddleElement = document.createElement("div");
+ this.trackMiddleElement.className = "ScrollbarTrackMiddle";
+ this.trackBottomElement = document.createElement("div");
+ this.trackBottomElement.className = "ScrollbarTrackBottom";
+
+ // thumb
+ this.thumbTopElement = document.createElement("div");
+ this.thumbTopElement.className = "ScrollbarThumbTop";
+ this.thumbMiddleElement = document.createElement("div");
+ this.thumbMiddleElement.className = "ScrollbarThumbMiddle";
+ this.thumbBottomElement = document.createElement("div");
+ this.thumbBottomElement.className = "ScrollbarThumbBottom";
+
+ // assemble and attach the scrollbar
+ this.rootElement.appendChild(this.trackTopElement);
+ this.rootElement.appendChild(this.trackMiddleElement);
+ this.rootElement.appendChild(this.trackBottomElement);
+ this.rootElement.appendChild(this.thumbTopElement);
+ this.rootElement.appendChild(this.thumbMiddleElement);
+ this.rootElement.appendChild(this.thumbBottomElement);
+ this.parentElement.appendChild(this.rootElement);
+
+ // bring the scrollbar up to date
+ this.update(0, 100, 100);
+}
+
+// Parent element for the scrollbar.
+Scrollbar.prototype.parentElement = null;
+
+// Root HTML element in the scrollbar.
+Scrollbar.prototype.rootElement = null;
+
+// Scrollbar track top element.
+Scrollbar.prototype.trackTopElement = null;
+
+// Scrollbar track middle element.
+Scrollbar.prototype.trackMiddleElement = null;
+
+// Scrollbar track bottom element.
+Scrollbar.prototype.trackBottomElement = null;
+
+// Scrollbar thumb top element.
+Scrollbar.prototype.thumbTopElement = null;
+
+// Scrollbar thumb middle element.
+Scrollbar.prototype.thumbMiddleElement = null;
+
+// Scrollbar thumb bottom element.
+Scrollbar.prototype.thumbBottomElement = null;
+
+// Is the scrollbar needed?
+Scrollbar.prototype.scrollbarNeeded = false;
+
+// Updates the scrollbar.
+Scrollbar.prototype.update = function(scrollY, viewportHeight, documentHeight) {
+ // figure out current heights
+ var scrollbarHeight = this.rootElement.clientHeight;
+ var trackTopHeight = this.trackTopElement.clientHeight;
+ var trackBottomHeight = this.trackBottomElement.clientHeight;
+ var thumbTopHeight = this.thumbTopElement.clientHeight;
+ var thumbBottomHeight = this.thumbBottomElement.clientHeight;
+
+ // scrollable height is the larger of document and viewport heights
+ var scrollableHeight = documentHeight;
+ var scrollbarNeeded = true;
+ if (viewportHeight >= documentHeight) {
+ scrollableHeight = viewportHeight;
+ scrollbarNeeded = false;
+ }
+
+ // show or hide scrollbar?
+ if (scrollbarNeeded != this.scrollbarNeeded) {
+ this.scrollbarNeeded = scrollbarNeeded;
+ this.rootElement.style.visibility = scrollbarNeeded ? "visible" : "hidden";
+ }
+
+ // calculate thumb top position...
+ var thumbTopPct = scrollY / scrollableHeight;
+ var thumbTop = scrollbarHeight * thumbTopPct;
+ // ...and bottom position...
+ var thumbBottomPct = (scrollY + viewportHeight) / scrollableHeight;
+ var thumbBottom = scrollbarHeight * thumbBottomPct;
+
+ // ...and thumb height
+ var thumbHeight = thumbBottom - thumbTop;
+
+ // ensure that the thumb is not too small
+ var thumbMinHeight = thumbTopHeight + thumbBottomHeight;
+ if (thumbHeight < thumbMinHeight) {
+ var underflow = thumbMinHeight - thumbHeight;
+ // adjust thumb top pos assuming a shorter scrollbar track
+ var thumbMid = (scrollbarHeight - underflow) * ((thumbTopPct + thumbBottomPct) / 2) + (underflow / 2);
+ thumbTop = thumbMid - (thumbMinHeight / 2);
+ thumbBottom = thumbTop + thumbMinHeight;
+ thumbHeight = thumbBottom - thumbTop;
+ }
+
+ // position and size track element (add 1 to the middle section height for rounding errors)
+ this.trackTopElement.style.top = "0px";
+ this.trackMiddleElement.style.top = Math.round(trackTopHeight) + "px";
+ this.trackMiddleElement.style.height = Math.round(scrollbarHeight - trackTopHeight - trackBottomHeight + 1) + "px";
+ this.trackBottomElement.style.top = Math.round(scrollbarHeight - trackTopHeight) + "px";
+
+ // position and size thumb element (add 1 to the middle section height for rounding errors)
+ this.thumbTopElement.style.top = Math.round(thumbTop) + "px";
+ this.thumbMiddleElement.style.top = Math.round(thumbTop + thumbTopHeight) + "px";
+ this.thumbMiddleElement.style.height = Math.round(thumbHeight - thumbTopHeight - thumbBottomHeight + 1) + "px";
+ this.thumbBottomElement.style.top = Math.round(thumbBottom - thumbBottomHeight) + "px";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/SelectionControl.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,189 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The SelectionControl class is an abstract base class for controls that lets
+// the user select one or more options from a list of options. Don't use
+// SelectionControl directly.
+
+// Constructor.
+function SelectionControl(id, caption, options, multipleSelection, selected) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, options, multipleSelection, selected);
+ }
+}
+
+// SelectionControl inherits from Control.
+SelectionControl.prototype = new Control(UI_NO_INIT_ID);
+
+// List of options.
+SelectionControl.prototype.options = null;
+
+// The single selected option in single selection controls
+// or list of options in multi selection controls.
+SelectionControl.prototype.selected = null;
+
+// Single or multiple selection.
+SelectionControl.prototype.multipleSelection = false;
+
+// Initializer - called from constructor.
+SelectionControl.prototype.init = function(id, caption, options, multipleSelection, selected) {
+ uiLogger.debug("SelectionControl.init(" + id + ", " + caption + ", " + options + ", " + multipleSelection + ", " + selected + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, caption);
+
+ // set the multiple selection property
+ this.multipleSelection = multipleSelection;
+
+ // init options and selected (makes copies of the original arrays)
+ this.options = (options != null) ? options.slice(0) : [];
+ if (multipleSelection) {
+ this.selected = (selected == null) ? [] : selected.slice(0);
+ } else {
+ this.selected = selected;
+ }
+ this.validateSelected();
+}
+
+// Returns true if the control is a multiple selection control; false if single.
+SelectionControl.prototype.isMultipleSelection = function() {
+ return this.multipleSelection;
+}
+
+// Returns true if the specified option is selected; false if not.
+SelectionControl.prototype.isSelected = function(option) {
+ if (this.multipleSelection) {
+ // multiple selection
+ // iterate through all selected options and look for the specified option
+ for (var i = 0; i < this.selected.length; i++) {
+ if (this.selected[i] == option) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ // single selection
+ return (this.selected == option);
+ }
+}
+
+// Returns the currently selected option in a single selection control or
+// an array of selected options in a multiple selection control. If there are
+// no selected options a single selection control returns null and a multiple
+// selection control returns an empty array.
+SelectionControl.prototype.getSelected = function() {
+ return this.multipleSelection ? this.selected.slice(0) : this.selected;
+}
+
+// Sets the currently selected options. Pass a single option in a single selection
+// control or an array of selected controls in a multiple selection control. To
+// deselect all options pass null in a single selection control and an empty array
+// in a multiple selection control.
+// Override in sublcasses to provide full implementation.
+SelectionControl.prototype.setSelected = function(selected) {
+ this.selected = this.multipleSelection ? selected.slice(0) : selected;
+ // make sure the selected option or options are legal
+ this.validateSelected();
+}
+
+// Ensures that the selected option or options exist among the options in this control.
+SelectionControl.prototype.validateSelected = function() {
+ if (this.multipleSelection) {
+ // multiple selection
+ // iterate through all selected options and ensure they exist among the options
+ for (var i = 0; i < this.selected.length; i++) {
+ // check that the selected option exists among the options
+ var found = false;
+ for (var j = 0; j < this.options.length; j++) {
+ if (this.options[j] == this.selected[i]) {
+ // found - stop looking for this option
+ found = true;
+ break;
+ }
+ }
+ // not found - remove this selected element
+ if (!found) {
+ this.selected.splice(i, 1);
+ // since we removed an entry we must re-check this position
+ i--;
+ }
+ }
+ } else {
+ // single selection
+ if (this.selected != null) {
+ // check that the selected option exists among the options
+ for (var i = 0; i < this.options.length; i++) {
+ if (this.options[i] == this.selected) {
+ // found - we're done
+ return;
+ }
+ }
+ // not found - remove the selection
+ this.selected = null;
+ }
+ }
+}
+
+// Returns the options in the control as an array of option objects with
+// a value and text property.
+SelectionControl.prototype.getOptions = function() {
+ return this.options;
+}
+
+// Sets the options in the control.
+// Override in sublcasses to provide full implementation.
+SelectionControl.prototype.setOptions = function(options) {
+ this.options = options.slice(0);
+ // make sure the selected option or options are legal
+ this.validateSelected();
+}
+
+// Returns the option that has the specified value; null if none.
+SelectionControl.prototype.getOptionForValue = function(value) {
+ // iterate through all options and look for a match
+ for (var i = 0; i < this.options.length; i++) {
+ if (this.options[i].value == value) {
+ return this.options[i];
+ }
+ }
+ return null;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/SelectionList.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,355 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The SelectionList class implements a single or multi selection control
+// that lets users select one or more options from a list of options.
+
+// Constructor.
+function SelectionList(id, caption, options, multipleSelection, selected) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, options, multipleSelection, selected);
+ }
+}
+
+// SelectionList inherits from SelectionControl.
+SelectionList.prototype = new SelectionControl(UI_NO_INIT_ID);
+
+// Root element for options.
+SelectionList.prototype.optionListElement = null;
+
+// Array for tracking option elements.
+SelectionList.prototype.optionElements = null;
+
+// Tracking for currently focused option; null if none.
+SelectionList.prototype.focusedOption = null;
+
+// Enabled status.
+SelectionList.prototype.enabled = false;
+
+// Initializer - called from constructor.
+SelectionList.prototype.init = function(id, caption, options, multipleSelection, selected) {
+ uiLogger.debug("SelectionList.init(" + id + ", " + caption + ", " + options + ", " + multipleSelection + ", " + selected + ")");
+
+ // call superclass initializer
+ SelectionControl.prototype.init.call(this, id, caption, options, multipleSelection, selected);
+
+ // create option list element
+ this.optionListElement = document.createElement("div");
+ this.controlElement.appendChild(this.optionListElement);
+
+ // the control defaults to enabled
+ this.enabled = true;
+
+ // init option element arrays
+ this.optionElements = [];
+
+ // update the option elements to match the options in this control
+ this.updateOptionElements();
+}
+
+// Returns the enabled state.
+SelectionList.prototype.isEnabled = function() {
+ return this.enabled;
+}
+
+// Sets the enabled state.
+SelectionList.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("SelectionList.setEnabled(" + enabled + ")");
+ // switch the state and update the the control
+ this.enabled = enabled;
+ this.updateOptionElements();
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+SelectionList.prototype.setFocused = function(focused) {
+ uiLogger.debug("SelectionList.setFocused(" + focused + ")");
+ if (this.enabled && this.optionElements.length > 0) {
+ if (focused) {
+ this.optionElements[0].link.focus();
+ } else {
+ this.optionElements[0].link.blur();
+ }
+ }
+}
+
+// Sets the currently selected options. Pass a single option in a single selection
+// control or an array of selected controls in a multiple selection control. To
+// deselect all options pass null in a single selection control and an empty array
+// in a multiple selection control.
+SelectionList.prototype.setSelected = function(selected) {
+ // call superclass setSelected()
+ SelectionControl.prototype.setSelected.call(this, selected);
+ this.updateStyleFromState();
+}
+
+// Sets the options in the control.
+SelectionList.prototype.setOptions = function(options) {
+ // call superclass setOptions()
+ SelectionControl.prototype.setOptions.call(this, options);
+ this.updateOptionElements();
+}
+
+// Updates the option elements for the control element.
+SelectionList.prototype.updateOptionElements = function() {
+ uiLogger.debug("SelectionControl.updateOptionElements()");
+
+ // start by removing all current options from the option list element
+ while (this.optionListElement.firstChild != null) {
+ this.optionListElement.removeChild(this.optionListElement.firstChild);
+ }
+
+ // iterate through the options and add (and possibly create) a
+ // properly configured option element for each option
+ for (var i = 0; i < this.options.length; i++) {
+ // get the option and option element we're working on
+ var option = this.options[i];
+
+ // option, link and text elements for this option
+ var optionElement;
+ var optionLinkElement;
+ var optionTextElement;
+
+ // get the elements
+ if (i == this.optionElements.length) {
+ // we need to create a new option element...
+ optionElement = document.createElement("div");
+
+ // ...and a new option link element...
+ optionLinkElement = document.createElement("a");
+ optionLinkElement.href = "JavaScript:void(0)";
+
+ // ...and a new option text element
+ optionTextElement = document.createElement("span");
+
+ // hook up event listeners to the element
+ var self = this;
+ optionLinkElement.addEventListener("focus", function(event) { self.optionFocusStateChanged(event, true); }, false);
+ optionLinkElement.addEventListener("blur", function(event) { self.optionFocusStateChanged(event, false); }, false);
+ optionElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
+ optionElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
+ optionElement.addEventListener("mousedown", function(event) {
+ self.optionClicked(event)
+ event.stopPropagation();
+ event.preventDefault();
+ }, true);
+ optionElement.addEventListener("keydown", function(event) {
+ // center and enter trigger the action
+ if (event.keyCode == 0 || event.keyCode == 13) {
+ self.optionClicked(event)
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ }, true);
+
+ // add the elements to the option element array
+ this.optionElements.push({ option: optionElement, link: optionLinkElement, text: optionTextElement });
+ } else {
+ // we already have ready elements so we'll reuse them
+ optionElement = this.optionElements[i].option;
+ optionLinkElement = this.optionElements[i].link;
+ optionTextElement = this.optionElements[i].text;
+
+ // remove the option link element from its current parent - if any
+ if (optionLinkElement.parentNode != null) {
+ optionLinkElement.parentNode.removeChild(optionLinkElement);
+ }
+
+ // remove the option text element from its current parent - if any
+ if (optionTextElement.parentNode != null) {
+ optionTextElement.parentNode.removeChild(optionTextElement);
+ }
+ }
+
+ // set the option text
+ optionTextElement.innerHTML = option.text;
+
+ // hook up the option to the control
+ if (this.enabled) {
+ // add the option link element to the option element
+ optionElement.appendChild(optionLinkElement);
+ // add the text element to the option element
+ optionLinkElement.appendChild(optionTextElement);
+ } else {
+ // add the text element directly to the control element
+ optionElement.appendChild(optionTextElement);
+ }
+ // add the option element to the option list element
+ this.optionListElement.appendChild(optionElement);
+ }
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Callback for focus state change events.
+SelectionList.prototype.optionFocusStateChanged = function(event, focused) {
+ uiLogger.debug("SelectionControl.optionFocusStateChanged()");
+
+ // get the event source option
+ var option = null;
+ var optionElement = null;
+ for (var i = 0; i < this.optionElements.length; i++) {
+ optionElement = this.optionElements[i];
+ if (optionElement.link == event.currentTarget) {
+ option = this.options[i];
+ break;
+ }
+ }
+
+ // remember the focused option; or null if none is focused
+ if (focused) {
+ this.focusedOption = option;
+ } else {
+ this.focusedOption = null;
+ }
+
+ // call the superclass focus state change handler
+ this.focusStateChanged(focused);
+}
+
+// Callback for clicks.
+SelectionList.prototype.optionClicked = function(event) {
+ uiLogger.debug("SelectionControl.optionClicked()");
+
+ // bail out if we're not enabled
+ if (!this.enabled) {
+ return false;
+ }
+
+ // get the changed option
+ var option = null;
+ var optionElement = null;
+ for (var i = 0; i < this.optionElements.length; i++) {
+ optionElement = this.optionElements[i];
+ if (optionElement.option == event.currentTarget) {
+ option = this.options[i];
+ break;
+ }
+ }
+
+ // make sure the option is focused
+ optionElement.link.focus();
+
+ // toggle the selection
+ if (this.multipleSelection) {
+ // iterate through the selected options and see if this
+ // option is selected. if not then add it to the selection.
+ // if it already is selected then them remove it.
+ var found = false;
+ for (var i = 0; i < this.selected.length; i++) {
+ if (this.selected[i] == option) {
+ // remove from selected set
+ found = true;
+ this.selected.splice(i, 1);
+ break;
+ }
+ }
+ if (!found) {
+ // add to the selected set
+ this.selected.push(option);
+ }
+ } else {
+ // update the selected option
+ this.selected = option;
+ }
+
+ // update the style
+ this.updateStyleFromState();
+
+ // notify event listeners
+ this.fireEvent(this.createEvent("SelectionChanged", this.getSelected()));
+}
+
+// Resets the state tracking for focus and hover.
+// Override this in subclasses as required to implement the state reset.
+SelectionList.prototype.resetFocusState = function() {
+ uiLogger.debug("SelectionList.resetFocusState()");
+ this.hovering = false;
+ this.focused = false;
+ this.focusedOption = null;
+ this.updateStyleFromState();
+}
+
+// Updates the style of the control to reflects the state of the control.
+SelectionList.prototype.updateStyleFromState = function() {
+ uiLogger.debug("SelectionList.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.controlElement, "ControlElement");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+ this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName);
+
+ // set option list and option class names
+ this.setClassName(this.optionListElement, "SelectionList SelectionList" + stateName);
+ for (var i = 0; i < this.options.length; i++) {
+ var option = this.options[i];
+
+ // get the option and option text elements for this option
+ var optionElement = this.optionElements[i].option;
+ var optionTextElement = this.optionElements[i].text;
+
+ // figure out the option state
+ var optionStateName = this.isSelected(option) ? "Checked" : "Unchecked";
+ if (!this.enabled) {
+ optionStateName += "Disabled";
+ } else if (this.focusedOption == option) {
+ optionStateName += "Focus";
+ } else {
+ optionStateName += "Normal";
+ }
+
+ // set option element class names
+ if (this.multipleSelection) {
+ this.setClassName(optionElement, "SelectionListOptionMulti SelectionListOptionMulti" + optionStateName);
+ } else {
+ this.setClassName(optionElement, "SelectionListOptionSingle SelectionListOptionSingle" + optionStateName);
+ }
+
+ // set option text class names
+ this.setClassName(optionTextElement, "SelectionListOptionText SelectionListOptionText" + stateName);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/SelectionMenu.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,204 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The SelectionMenu class implements a single or multi selection control
+// that lets users select one or more options from a menu.
+
+// Constructor.
+function SelectionMenu(id, caption, options, multipleSelection, selected) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, options, multipleSelection, selected);
+ }
+}
+
+// SelectionMenu inherits from SelectionControl.
+SelectionMenu.prototype = new SelectionControl(UI_NO_INIT_ID);
+
+// Reference to the peer HTML element.
+SelectionControl.prototype.peerElement = null;
+
+// Array for tracking option elements.
+SelectionMenu.prototype.optionElements = null;
+
+// Initializer - called from constructor.
+SelectionMenu.prototype.init = function(id, caption, options, multipleSelection, selected) {
+ uiLogger.debug("SelectionMenu.init(" + id + ", " + caption + ", " + options + ", " + multipleSelection + ", " + selected + ")");
+
+ // call superclass initializer
+ SelectionControl.prototype.init.call(this, id, caption, options, multipleSelection, selected);
+
+ // create the control
+ this.peerElement = document.createElement("select");
+ this.peerElement.multiple = multipleSelection;
+ this.controlElement.appendChild(this.peerElement);
+
+ // init option elements array
+ this.optionElements = [];
+
+ // update the option elements to match the options in this control
+ this.updateOptionElements();
+
+ // bind event listeners
+ var self = this;
+ this.peerElement.addEventListener("focus", function() { self.focusStateChanged(true); }, false);
+ this.peerElement.addEventListener("blur", function() { self.focusStateChanged(false); }, false);
+ this.peerElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
+ this.peerElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
+ this.peerElement.addEventListener("change", function() { self.selectionChanged(); }, false);
+}
+
+// Returns the enabled state.
+SelectionMenu.prototype.isEnabled = function() {
+ return !this.peerElement.disabled;
+}
+
+// Sets the enabled state.
+SelectionMenu.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("SelectionMenu.setEnabled(" + enabled + ")");
+ this.peerElement.disabled = !enabled;
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+SelectionMenu.prototype.setFocused = function(focused) {
+ uiLogger.debug("SelectionMenu.setFocused(" + focused + ")");
+ if (focused) {
+ this.peerElement.focus();
+ } else {
+ this.peerElement.blur();
+ }
+}
+
+// Sets the currently selected options. Pass a single option in a single selection
+// control or an array of selected controls in a multiple selection control. To
+// deselect all options pass null in a single selection control and an empty array
+// in a multiple selection control.
+SelectionMenu.prototype.setSelected = function(selected) {
+ // call superclass setSelected()
+ SelectionControl.prototype.setSelected.call(this, selected);
+
+ // iterate through the options and set the selected state
+ // on the corresponding option element
+ for (var i = 0; i < this.options.length; i++) {
+ this.optionElements[i].selected = this.isSelected(this.options[i]);
+ }
+}
+
+// Sets the options in the control.
+SelectionMenu.prototype.setOptions = function(options) {
+ // call superclass setOptions()
+ SelectionControl.prototype.setOptions.call(this, options);
+ this.updateOptionElements();
+}
+
+// Updates the option elements for the peer select element.
+SelectionMenu.prototype.updateOptionElements = function() {
+ // start by removing all current options from the select element
+ while (this.peerElement.firstChild != null) {
+ this.peerElement.removeChild(this.peerElement.firstChild);
+ }
+
+ // iterate through the options and add (and possibly create) a
+ // properly configured option element for each option
+ for (var i = 0; i < this.options.length; i++) {
+ // do we need to create a new option element?
+ if (i == this.optionElements.length) {
+ this.optionElements.push(document.createElement("option"));
+ }
+
+ // get the option and option element we're working on
+ var option = this.options[i];
+ var optionElement = this.optionElements[i];
+
+ // set the state for this option element and add it to the
+ // peer select element
+ optionElement.text = option.text;
+ optionElement.selected = this.isSelected(option);
+ this.peerElement.appendChild(optionElement);
+ }
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Callback for selection change events.
+SelectionMenu.prototype.selectionChanged = function() {
+ uiLogger.debug("SelectionControl.selectionChanged()");
+
+ // update the selected options array or reference
+ this.selected = (this.multipleSelection) ? [] : null;
+ for (var i = 0; i < this.options.length; i++) {
+ if (this.optionElements[i].selected) {
+ if (this.multipleSelection) {
+ this.selected.push(this.options[i]);
+ } else {
+ this.selected = this.options[i];
+ break;
+ }
+ }
+ }
+
+ // notify event listeners
+ this.fireEvent(this.createEvent("SelectionChanged", this.getSelected()));
+}
+
+// Updates the style of the control to reflects the state of the control.
+SelectionMenu.prototype.updateStyleFromState = function() {
+ uiLogger.debug("SelectionMenu.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.controlElement, "ControlElement");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+ this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName);
+
+ // set select and option element class names
+ var peerStateName = this.isEnabled() ? stateName : "Disabled";
+ this.setClassName(this.peerElement, "SelectionMenu SelectionMenu" + peerStateName);
+ for (var i = 0; i < this.options.length; i++) {
+ var option = this.optionElements[i];
+ this.setClassName(option, "SelectionMenuOption SelectionMenuOption" + peerStateName);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/Separator.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,119 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The Separator class is used to provide a visual separator in a list.
+
+// Constructor.
+function Separator(id) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id);
+ }
+}
+
+// Separator inherits from Control.
+Separator.prototype = new Control(UI_NO_INIT_ID);
+
+// Reference to the separator element.
+Separator.prototype.separatorElement = null;
+
+// Separator row element.
+Separator.prototype.tableRowElement = null;
+
+// Left cell element.
+Separator.prototype.tableLeftCellElement = null;
+
+// Center cell element.
+Separator.prototype.tableCenterCellElement = null;
+
+// Right cell element.
+Separator.prototype.tableRightCellElement = null;
+
+// Initializer - called from constructor.
+Separator.prototype.init = function(id) {
+ uiLogger.debug("Separator.init(" + id + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, null);
+
+ // remove caption and control elements
+ this.assemblyElement.removeChild(this.captionElement);
+ this.assemblyElement.removeChild(this.controlElement);
+
+ // create separator
+ this.separatorElement = document.createElement("table");
+ this.tableRowElement = document.createElement("tr");
+ this.tableLeftCellElement = document.createElement("td");
+ this.tableCenterCellElement = document.createElement("td");
+ this.tableRightCellElement = document.createElement("td");
+ this.tableRowElement.appendChild(this.tableLeftCellElement);
+ this.tableRowElement.appendChild(this.tableCenterCellElement);
+ this.tableRowElement.appendChild(this.tableRightCellElement);
+ this.separatorElement.appendChild(this.tableRowElement);
+ this.assemblyElement.appendChild(this.separatorElement);
+
+ // update style
+ this.updateStyleFromState();
+}
+
+// Returns the enabled state for the control.
+Separator.prototype.isEnabled = function() {
+ return true;
+}
+
+// Returns the focusable state for the control.
+Separator.prototype.isFocusable = function() {
+ return false;
+}
+
+// Updates the style of the control to reflects the state of the control.
+Separator.prototype.updateStyleFromState = function() {
+ uiLogger.debug("Separator.updateStyleFromState()");
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssemblyNormal");
+ this.setClassName(this.separatorElement, "Separator");
+ this.setClassName(this.tableRowElement, "SeparatorRow");
+ this.setClassName(this.tableLeftCellElement, "SeparatorLeftCell");
+ this.setClassName(this.tableCenterCellElement, "SeparatorCenterCell");
+ this.setClassName(this.tableRightCellElement, "SeparatorRightCell");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/TextArea.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,96 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The TextArea class implements a multi line text entry control.
+
+// Constructor.
+function TextArea(id, caption, value, rows) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, value, rows);
+ }
+}
+
+// TextArea inherits from TextEntryControl.
+TextArea.prototype = new TextEntryControl(UI_NO_INIT_ID);
+
+// Initializer - called from constructor.
+TextArea.prototype.init = function(id, caption, value, rows) {
+ uiLogger.debug("TextArea.init(" + id + ", " + caption + ", " + value + ", " + rows + ")");
+
+ // call superclass initializer
+ TextEntryControl.prototype.init.call(this, id, caption);
+
+ // create the peer element
+ this.peerElement = document.createElement("textarea");
+ // default rowcount is 3 if not defined
+ // width always comes from style but is a required attribute
+ this.peerElement.rows = (rows != null) ? rows : 3;
+ this.peerElement.cols = 20;
+ this.controlElement.appendChild(this.peerElement);
+
+ // set the value
+ this.peerElement.value = (value == null) ? "" : value;
+
+ // bind event listeners
+ this.bindTextEntryControlListeners();
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Updates the style of the control to reflects the state of the control.
+TextArea.prototype.updateStyleFromState = function() {
+ uiLogger.debug("TextArea.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.controlElement, "ControlElement");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+ this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName);
+
+ // set peer element class names
+ var peerStateName = this.isEnabled() ? stateName : "Disabled";
+ this.setClassName(this.peerElement, "TextArea TextArea" + stateName);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/TextEntryControl.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,125 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The TextEntryControl class is an abstract base class for the single and multi-
+// line text entry controls TextField and TextArea. Don't use TextEntryControl
+// directly.
+
+// Constructor.
+function TextEntryControl(id, caption) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption);
+ }
+}
+
+// TextEntryControl inherits from Control.
+TextEntryControl.prototype = new Control(UI_NO_INIT_ID);
+
+// Reference to the peer HTML element.
+TextEntryControl.prototype.peerElement = null;
+
+// Initializer - called from constructor.
+TextEntryControl.prototype.init = function(id, caption) {
+ uiLogger.debug("TextEntryControl.init(" + id + ", " + caption + ")");
+
+ // call superclass initializer
+ Control.prototype.init.call(this, id, caption);
+}
+
+// Common event listeners hookup function called from subclasses.
+TextEntryControl.prototype.bindTextEntryControlListeners = function() {
+ var self = this;
+ this.peerElement.addEventListener("focus", function() { self.focusStateChanged(true); }, false);
+ this.peerElement.addEventListener("blur", function() { self.focusStateChanged(false); }, false);
+ this.peerElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
+ this.peerElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
+ this.peerElement.addEventListener("change", function() { self.valueChanged(); }, false);
+}
+
+// Returns the enabled state.
+// Override this in subclasses as required to implement the state change.
+TextEntryControl.prototype.isEnabled = function() {
+ return !this.peerElement.readOnly;
+}
+
+// Sets the enabled state.
+// Override this in subclasses as required to implement the state change.
+TextEntryControl.prototype.setEnabled = function(enabled) {
+ uiLogger.debug("TextEntryControl.setEnabled(" + enabled + ")");
+ this.peerElement.readOnly = !enabled;
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Returns the control text.
+TextEntryControl.prototype.getText = function() {
+ return this.peerElement.value;
+}
+
+// Sets the text for the control.
+TextEntryControl.prototype.setText = function(text) {
+ this.peerElement.value = text;
+}
+
+// Returns the focusable state for the control.
+TextEntryControl.prototype.isFocusable = function() {
+ // text entry controls are always focusable
+ return true;
+}
+
+// Sets the focused state for the control.
+// Note: This may not always succeed.
+TextEntryControl.prototype.setFocused = function(focused) {
+ uiLogger.debug("TextEntryControl.setFocused(" + focused + ")");
+ if (focused) {
+ this.peerElement.focus();
+ } else {
+ this.peerElement.blur();
+ }
+}
+
+// Callback for value change events.
+TextEntryControl.prototype.valueChanged = function() {
+ uiLogger.debug("TextEntryControl.valueChanged()");
+ // notify event listeners
+ this.fireEvent(this.createEvent("ValueChanged", this.peerElement.value));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/TextField.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,93 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The TextField class implements a single line text entry control.
+
+// Constructor.
+function TextField(id, caption, value, masked) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id, caption, value, masked);
+ }
+}
+
+// TextField inherits from TextEntryControl.
+TextField.prototype = new TextEntryControl(UI_NO_INIT_ID);
+
+// Initializer - called from constructor.
+TextField.prototype.init = function(id, caption, value, masked) {
+ uiLogger.debug("TextField.init(" + id + ", " + caption + ", " + value + ", " + masked + ")");
+
+ // call superclass initializer
+ TextEntryControl.prototype.init.call(this, id, caption);
+
+ // create the peer element
+ this.peerElement = document.createElement("input");
+ this.peerElement.type = masked ? "password" : "text";
+ this.controlElement.appendChild(this.peerElement);
+
+ // set the value
+ this.peerElement.value = (value == null) ? "" : value;
+
+ // bind event listeners
+ this.bindTextEntryControlListeners();
+
+ // update the style
+ this.updateStyleFromState();
+}
+
+// Updates the style of the control to reflects the state of the control.
+TextField.prototype.updateStyleFromState = function() {
+ uiLogger.debug("TextField.updateStyleFromState()");
+
+ // determine the state name
+ var stateName = this.getStyleStateName();
+
+ // set element class names
+ this.setClassName(this.rootElement, "Control");
+ this.setClassName(this.controlElement, "ControlElement");
+ this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
+ this.setClassName(this.captionElement, "ControlCaption ControlCaption" + stateName);
+
+ // set peer element class names
+ var peerStateName = this.isEnabled() ? stateName : "Disabled";
+ this.setClassName(this.peerElement, "TextField TextField" + peerStateName);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/UIElement.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,114 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The UIElement class is the base class for all user interface elements.
+
+// Constructor.
+function UIElement(id) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id);
+ }
+}
+
+// UI element identifier.
+UIElement.prototype.id = null;
+
+// Root HTML element in the UI element.
+UIElement.prototype.rootElement = null;
+
+// Initializer for UIElement.
+UIElement.prototype.init = function(id) {
+ uiLogger.debug("UIElement.init(" + id + ")");
+
+ // copy identifier
+ this.id = id;
+
+ // init event listener array
+ this.eventListeners = [];
+
+ // create the root element
+ this.rootElement = document.createElement("div");
+ if (id != null) {
+ this.rootElement.id = id;
+ }
+}
+
+// Returns an array containing the current event listeners.
+UIElement.prototype.getEventListeners = function() {
+ return this.eventListeners;
+}
+
+// Adds an event listener.
+UIElement.prototype.addEventListener = function(eventType, listener) {
+ var listenerDef = { type: eventType, listener: listener };
+ this.eventListeners.push(listenerDef);
+}
+
+// Removes an event listener.
+UIElement.prototype.removeEventListener = function(eventType, listener) {
+ // iterate through current listeners and remove the specified
+ // listener when its found
+ for (var i = 0; i < this.eventListeners.length; i++) {
+ var listenerDef = this.eventListeners[i];
+ if ((listenerDef.type == eventType) &&
+ (listenerDef.listener == listener)) {
+ this.eventListeners.splice(i, 1);
+ return;
+ }
+ }
+}
+
+// Factory method for an event object where this object is the source object.
+UIElement.prototype.createEvent = function(type, value) {
+ return { source: this, type: type, value: value };
+}
+
+// Fires an event to all listeners.
+UIElement.prototype.fireEvent = function(event) {
+ // iterate through all event listeners and notify them of the event
+ for (var i = 0; i < this.eventListeners.length; i++) {
+ var listenerDef = this.eventListeners[i];
+ if (listenerDef.type == null || listenerDef.type == event.type) {
+ listenerDef.listener.call(this, event);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/UIInit.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,49 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The UIInit script is included before the rest of the UI scripts to setup
+// any resources needed by the UI toolkit.
+
+// Create UI logger.
+var uiLogger = new Logger();
+uiLogger.level = uiLogger.LOG_LEVEL_OFF;
+uiLogger.filter = ["QECR"];
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/UIManager.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,240 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (ÒNokiaÓ) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under NokiaÕs copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The UI manager manages a set of views and other user interface elements.
+
+// Constructor.
+function UIManager(viewParentElement, scrollbarParentElement, enableScrollBar, delayInit) {
+ uiLogger.debug("UIManager(" + viewParentElement + ", " + scrollbarParentElement + ")");
+ if (delayInit == null) {
+ this.init(viewParentElement, enableScrollBar, scrollbarParentElement);
+ }
+}
+
+// Parent element for views.
+UIManager.prototype.viewParentElement = null;
+
+// Parent element for scrollbar.
+UIManager.prototype.scrollbarParentElement = null;
+
+// The currently displayed view.
+UIManager.prototype.currentView = null;
+
+// Reference to the scrollbar.
+UIManager.prototype.scrollbar = null;
+
+// Current scroll Y position.
+UIManager.prototype.scrollY = -1;
+
+// Current viewport height.
+UIManager.prototype.viewportHeight = -1;
+
+// Current document height.
+UIManager.prototype.documentHeight = -1;
+
+// Timer identifier or null if no active timer.
+UIManager.prototype.timerId = null;
+
+// Interval for timer ticks for the UI manager timer (in milliseconds)
+UIManager.prototype.TIMER_INTERVAL = 250;
+
+// Reference to the notification popup used to displays notifications.
+UIManager.prototype.notificationPopup = null;
+
+// is scrollbar enabled
+UIManager.prototype.enableScrollBar = null;
+
+// init function
+UIManager.prototype.init = function(viewParentElement, enableScrollBar, scrollbarParentElement) {
+ this.enableScrollBar = enableScrollBar;
+
+ // parent element for views
+ if (viewParentElement == null) {
+ // create a parent for views
+ this.viewParentElement = document.createElement("div");
+ this.viewParentElement.className = "ViewContainer";
+ document.body.appendChild(this.viewParentElement);
+ }
+ else {
+ this.viewParentElement = viewParentElement;
+ }
+
+ // parent element for scrollbar
+ if (enableScrollBar) {
+ if (scrollbarParentElement == null) {
+ // create a parent for the scrollbar
+ this.scrollbarParentElement = document.createElement("div");
+ this.scrollbarParentElement.className = "DocumentScrollbarContainer";
+ document.body.appendChild(this.scrollbarParentElement);
+ }
+ else {
+ this.scrollbarParentElement = scrollbarParentElement;
+ }
+ }
+
+ // currently selected view
+ this.currentView = null;
+
+ // create the notification popup
+ // the notification popup adds itself as a child element to the document body
+ this.notificationPopup = new NotificationPopup();
+
+ // create scrollbar
+ if (enableScrollBar) {
+ this.scrollbar = new Scrollbar(this.scrollbarParentElement);
+ }
+
+ // setup scrollbar tracking
+ var self = this;
+ this.startTimer();
+ if (enableScrollBar) {
+ window.addEventListener("resize", function(){
+ self.updateScrollbar();
+ }, false);
+ window.addEventListener("scroll", function(){
+ self.updateScrollbar();
+ }, false);
+ }
+}
+
+// Returns the current view.
+UIManager.prototype.getView = function() {
+ return this.currentView;
+}
+
+// Switches to the specified view.
+UIManager.prototype.setView = function(view) {
+ uiLogger.debug("View set to " + view.id);
+
+ // remove the current view from the parent element
+ if (this.currentView != null) {
+ this.viewParentElement.removeChild(this.currentView.rootElement);
+ }
+
+ // reset scroll
+ window.scrollTo(0, 0);
+
+ // add the new view to the parent element
+ if (view != null) {
+ this.currentView = view;
+ this.currentView.resetControlFocusStates();
+ this.viewParentElement.appendChild(this.currentView.rootElement);
+ }
+
+ // update scrollbar
+ if (this.enableScrollBar) {
+ this.updateScrollbar();
+ }
+
+ // focus the first focusable control
+ // a timer is used to prevent unwanted focus shift
+ setTimeout(function() { view.focusFirstControl(); }, 1);
+}
+
+// Updates the scrollbar.
+UIManager.prototype.updateScrollbar = function() {
+ if (this.enableScrollBar) {
+ // get current viewport and document position and dimensions
+ var scrollY = window.scrollY;
+ var viewportHeight = window.innerHeight;
+ var documentHeight = Math.max(document.documentElement.scrollHeight, document.height);
+
+ // check if the scroll position or view has changed
+ if (this.scrollY != scrollY ||
+ this.viewportHeight != viewportHeight ||
+ this.documentHeight != documentHeight) {
+ // scroll position or view has changed
+ this.scrollY = scrollY;
+ this.viewportHeight = viewportHeight;
+ this.documentHeight = documentHeight;
+
+ // update the scrollbar
+ this.scrollbar.update(scrollY, viewportHeight, documentHeight);
+ uiLogger.debug("Scrollbar updated");
+ }
+ }
+}
+
+// Starts the view manager timer.
+UIManager.prototype.startTimer = function() {
+ if (this.timerId == null) {
+ uiLogger.debug("UIManager timer started");
+ var self = this;
+ // setup the timer
+ this.timerId = setInterval(function() { self.onTimer(); }, this.TIMER_INTERVAL);
+ } else {
+ uiLogger.warn("UIManager timer already running");
+ }
+}
+
+// Stops the view manager timer.
+UIManager.prototype.stopTimer = function() {
+ if (this.timerId != null) {
+ // stop the timer
+ clearTimeout(this.timerId);
+ this.timerId = null;
+ } else {
+ uiLogger.warn("UIManager timer already stopped");
+ }
+}
+
+// Timer callback function.
+UIManager.prototype.onTimer = function() {
+ if (this.enableScrollBar) {
+ // make sure the scrollbar is up to date
+ this.updateScrollbar();
+ }
+}
+
+// Displays a notification.
+UIManager.prototype.showNotification = function(displayTime, type, text, progress) {
+ uiLogger.debug("UIManager.showNotification(" + displayTime + ", " + type + ", " + text + ", " + progress + ")");
+ // use the notification popup to show the notification
+ this.notificationPopup.showNotification(displayTime, type, text, progress);
+}
+
+// Hides the currently displayed notification.
+UIManager.prototype.hideNotification = function() {
+ uiLogger.debug("UIManager.hideNotification()");
+ // hide the notification popup
+ this.notificationPopup.hideNotification();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/View.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,90 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (“Nokia”) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia’s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// The View class is an abstract base class for views in the UI toolkit.
+// Don't use the View directly - instead use a concrete subclass like ListView.
+
+// Constructor.
+function View(id) {
+ if (id != UI_NO_INIT_ID) {
+ this.init(id);
+ }
+}
+
+// View inherits from UIElement.
+View.prototype = new UIElement(UI_NO_INIT_ID);
+
+// Currently focused control.
+View.prototype.focusedControl = null;
+
+// Initializer - called from constructor.
+View.prototype.init = function(id) {
+ uiLogger.debug("View.init(" + id + ")");
+
+ // call superclass initializer
+ UIElement.prototype.init.call(this, id);
+}
+
+// Returns the currently focused control; null if none.
+View.prototype.getFocusedControl = function() {
+ return this.focusedControl;
+}
+
+// Used to notify the view that the focused control has changed.
+View.prototype.focusedControlChanged = function(control) {
+ uiLogger.debug("View.focusedControlChanged(" + control + ")");
+ this.focusedControl = control;
+ // notify event listeners
+ this.fireEvent(this.createEvent("FocusedControlChanged", this.focusedControl));
+}
+
+// Attempts to focus the first focusable control.
+// Override in subclasses as required.
+View.prototype.focusFirstControl = function() {
+ uiLogger.debug("View.focusFirstControl()");
+}
+
+// Attempts to reset all control focus states.
+// Override in subclasses as required.
+View.prototype.resetControlFocusStates = function() {
+ uiLogger.debug("View.resetControlFocusStates()");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/Utils/Logger.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,117 @@
+/*
+© Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (ÒNokiaÓ) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under NokiaÕs copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// Logger utility class that uses the Firebug console class.
+
+// Constructor (everything is static so this is empty).
+function Logger() {
+ // Set default logger level.
+ this.level = this.LOG_LEVEL_OFF;
+}
+
+// Logger levels.
+Logger.prototype.LOG_LEVEL_DEBUG = 0;
+Logger.prototype.LOG_LEVEL_INFO = 1;
+Logger.prototype.LOG_LEVEL_WARN = 2;
+Logger.prototype.LOG_LEVEL_ERROR = 3;
+Logger.prototype.LOG_LEVEL_OFF = 4;
+
+Logger.prototype.level = null;
+Logger.prototype.filter = null;
+
+// Disable logging on other browsers except Firefox.
+Logger.prototype.enabled = (navigator.userAgent.indexOf("Firefox") != -1);
+
+// Dumps an objects properties and methods to the console.
+Logger.prototype.dump = function(obj) {
+ if (this.enabled) {
+ console.dir(obj);
+ }
+}
+
+// Dumps a stracktrace to the console.
+Logger.prototype.trace = function() {
+ if (this.enabled) {
+ console.trace();
+ }
+}
+
+// Prints a debug message to the console.
+Logger.prototype.debug = function(str) {
+ if (this.enabled && this.level <= this.LOG_LEVEL_DEBUG) {
+ if (this.filter == null) {
+ console.debug(str);
+ } else {
+ var show = false;
+ for (i in this.filter) {
+ if (str.indexOf(this.filter[i]) >= 0) {
+ show = true;
+ break;
+ }
+ }
+ if (show) {
+ console.debug(str);
+ }
+ }
+ }
+}
+
+// Prints an info message to the console.
+Logger.prototype.info = function(str) {
+ if (this.enabled && this.level <= this.LOG_LEVEL_INFO) {
+ console.info(str);
+ }
+}
+
+// Prints a warning message to the console.
+Logger.prototype.warn = function(str) {
+ if (this.enabled && this.level <= this.LOG_LEVEL_WARN) {
+ console.warn(str);
+ }
+}
+
+// Prints an error message to the console.
+Logger.prototype.error = function(str) {
+ if (this.enabled && this.level <= this.LOG_LEVEL_ERROR) {
+ console.error(str);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/projecttemplates/WRTKit/WRTKit.js Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,90 @@
+/*
+� Copyright 2008 Nokia Corporation. All rights reserved.
+
+IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
+Corporation (�Nokia�) in consideration of your agreement to the following terms. Your use, installation
+and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
+you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
+Widget files.
+
+In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
+grants you a personal, non-exclusive license, under Nokia�s copyrights in the WRTKit and Example
+Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
+CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
+Widgets.
+
+If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
+redistributions of the WRTKit and Example files.
+
+You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
+that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
+Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
+Nokia herein, including but not limited to any patent rights that may be infringed by your products that
+incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
+may be incorporated.
+
+The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
+ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
+DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
+OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
+EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// This script includes the WRTKit for use in a widget.
+
+// WRTKit version (major.minor.revision, e.g. 1.0.0).
+var WRTKIT_VERSION_MAJOR = 1;
+var WRTKIT_VERSION_MINOR = 0;
+var WRTKIT_VERSION_REVISION = 0;
+var WRTKIT_RESOURCE_DIRECTORY = "WRTKit/Resources/";
+
+// Include util script files.
+includeScript("WRTKit/Utils/Logger.js");
+
+// Include UI visual definition.
+includeStyleSheet("WRTKit/Resources/UI.css");
+
+// Include all UI toolkit script files.
+var UI_NO_INIT_ID = "UI_NO_INIT_ID";
+
+includeScript("WRTKit/UI/UIInit.js");
+includeScript("WRTKit/UI/UIElement.js");
+includeScript("WRTKit/UI/Scrollbar.js");
+includeScript("WRTKit/UI/NotificationPopup.js");
+includeScript("WRTKit/UI/UIManager.js");
+includeScript("WRTKit/UI/View.js");
+includeScript("WRTKit/UI/ListView.js");
+includeScript("WRTKit/UI/Control.js");
+includeScript("WRTKit/UI/Separator.js");
+includeScript("WRTKit/UI/Label.js");
+includeScript("WRTKit/UI/ContentPanel.js");
+includeScript("WRTKit/UI/TextEntryControl.js");
+includeScript("WRTKit/UI/TextField.js");
+includeScript("WRTKit/UI/TextArea.js");
+includeScript("WRTKit/UI/SelectionControl.js");
+includeScript("WRTKit/UI/SelectionMenu.js");
+includeScript("WRTKit/UI/SelectionList.js");
+includeScript("WRTKit/UI/ActionControl.js");
+includeScript("WRTKit/UI/FormButton.js");
+includeScript("WRTKit/UI/NavigationButton.js");
+includeScript("WRTKit/UI/Ajax.js");
+
+// Includes a script file by writing a script tag.
+function includeScript(src) {
+ document.write("<script type=\"text/javascript\" src=\"" + src + "\"></script>");
+}
+
+// Includes a style sheet by writing a style tag.
+function includeStyleSheet(src) {
+ document.write("<style type=\"text/css\"> @import url(\"" + src + "\"); </style>");
+}
Binary file org.symbian.tools.wrttools/projecttemplates/flickr.zip has changed
Binary file org.symbian.tools.wrttools/projecttemplates/rssreader.zip has changed
Binary file org.symbian.tools.wrttools/projecttemplates/wrtkit.zip has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/ConsoleFactory.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools;
+
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleFactory;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+public class ConsoleFactory implements IConsoleFactory {
+
+ private static MessageConsole console;
+
+ public void openConsole() {
+ getConsole();
+ console.activate();
+ }
+
+ public static MessageConsoleStream createStream() {
+ getConsole();
+ return console.newMessageStream();
+ }
+
+ public static void activateConsole() {
+ getConsole();
+ console.activate();
+ }
+
+ private synchronized static MessageConsole getConsole() {
+ if (console == null) {
+ console = new MessageConsole("Web Runtime Console", null, true);
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ consoleManager.addConsoles(new IConsole[]{console});
+ }
+ return console;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTStatusListener.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
+import org.symbian.tools.wrttools.core.status.WRTStatus;
+
+public class WRTStatusListener implements IWRTStatusListener {
+
+ private MessageConsoleStream consoleStream;
+ private boolean activateOnFirstStatus = true;
+ private int statusCount;
+
+ public WRTStatusListener() {
+ consoleStream = ConsoleFactory.createStream();
+ }
+
+ public void close() {
+ try {
+ consoleStream.close();
+ } catch (IOException x) {
+ Activator.log(IStatus.ERROR, "Error closing console stream", x);
+ }
+ }
+
+ public void emitStatus(WRTStatus status) {
+ Object description = status.getStatusDescription();
+ if (description != null) {
+ ++statusCount;
+ if (activateOnFirstStatus && statusCount == 1) {
+ ConsoleFactory.activateConsole();
+ }
+
+ consoleStream.println(description.toString());
+ }
+ }
+
+ public boolean isStatusHandled(WRTStatus status) {
+ return true;
+ }
+
+}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WidgetProjectNature.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WidgetProjectNature.java Tue Feb 02 08:17:07 2010 -0800
@@ -19,51 +19,19 @@
package org.symbian.tools.wrttools;
-import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.runtime.CoreException;
-import org.symbian.tools.wrttools.core.validator.WidgetProjectValidator;
-
public class WidgetProjectNature implements IProjectNature {
public static final String ID = Activator.PLUGIN_ID + ".WidgetProjectNature";
private IProject project;
public void configure() throws CoreException {
- IProjectDescription desc = project.getDescription();
- ICommand[] commands = desc.getBuildSpec();
-
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(WidgetProjectValidator.BUILDER_ID)) {
- return;
- }
- }
-
- ICommand[] newCommands = new ICommand[commands.length + 1];
- System.arraycopy(commands, 0, newCommands, 0, commands.length);
- ICommand command = desc.newCommand();
- command.setBuilderName(WidgetProjectValidator.BUILDER_ID);
- newCommands[newCommands.length - 1] = command;
- desc.setBuildSpec(newCommands);
- project.setDescription(desc, null);
}
public void deconfigure() throws CoreException {
- IProjectDescription description = getProject().getDescription();
- ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; ++i) {
- if (commands[i].getBuilderName().equals(WidgetProjectValidator.BUILDER_ID)) {
- ICommand[] newCommands = new ICommand[commands.length - 1];
- System.arraycopy(commands, 0, newCommands, 0, i);
- System.arraycopy(commands, i + 1, newCommands, i,
- commands.length - i - 1);
- description.setBuildSpec(newCommands);
- return;
- }
- }
}
public IProject getProject() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/exception/WRTException.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.exception;
+
+/**
+ * The main class for the widget exception.
+ * Specific modules need to inherit the class and customize their corresponding
+ * exceptions.
+ * @author avraina
+ *
+ */
+public class WRTException extends Exception {
+
+ private static final long serialVersionUID = -1450794313853330624L;
+
+ /**
+ * Default constructor.
+ */
+ public WRTException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public WRTException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public WRTException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public WRTException(Throwable cause) {
+ super(cause);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/ExcludeFileAction.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+import org.symbian.tools.wrttools.Activator;
+
+public class ExcludeFileAction implements IObjectActionDelegate {
+
+ private List<IFile> selectedFiles = new ArrayList<IFile>();
+ private List<IFolder> selectedFolders = new ArrayList<IFolder>();
+ public ExcludeFileAction() {
+ super();
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ for (IFile file : selectedFiles) {
+ try {
+ file.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
+ } catch (CoreException x) {
+ Activator.log(IStatus.ERROR, "error setting exclude property on file: "+file.getName(), x);
+ }
+ }
+
+ for(IFolder folder : selectedFolders){
+ try{
+ folder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
+ excludeFolder( folder);
+ }
+ catch (CoreException x) {
+ Activator.log(IStatus.ERROR, "error setting exclude property on folder: "+folder.getName(), x);
+ }
+ }
+ /*Refresh project tree when property is changed */
+ PlatformUI.getWorkbench().getDecoratorManager().update("com.nokia.wrt.decorator");
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ selectedFiles.clear();
+ selectedFolders.clear();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator iter = ss.iterator(); iter.hasNext();) {
+ Object obj = iter.next();
+ if (obj instanceof IFile) {
+
+ IFile file = (IFile) obj;
+ selectedFiles.add(file);
+
+ }
+
+ if(obj instanceof IFolder){
+ IFolder folder = (IFolder) obj;
+ selectedFolders.add(folder);
+ }
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @param folder
+ * @throws CoreException
+ */
+
+ private void excludeFolder(IFolder folder) throws CoreException{
+ folder.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource)throws CoreException {
+ if (resource instanceof IFile) {
+ IFile file = (IFile) resource;
+ file.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
+ }
+ else if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ folder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
+ }
+ return true;
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/IWRTPackager.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.symbian.tools.wrttools.core.exception.WRTException;
+
+/**
+ * Main Interface for Packaging.
+ * @author Nutan
+ *
+ */
+public interface IWRTPackager {
+
+ /**
+ * This method is used to check user Input for Packaging (A project folder or .Zip file)
+ * Returns 0 for file type .zip and 1 for Project folder and 2 for any thing else
+ * @return int returns project input type format
+ * @throws WRTException
+ */
+ public int checkInputType() throws PackageException;
+
+ /**
+ * This method will convert validated folder into .zip file
+ * Method implementation using java.util.zip package
+ * This method will rename the file from .zip extension to .wgz
+ * @throws PackageException
+ * @throws IOException
+ */
+ public void packageWidget(String sPath, String dPath, List<String> fileList) throws PackageException ;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/IncludeFileAction.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,121 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+import org.symbian.tools.wrttools.Activator;
+
+public class IncludeFileAction implements IObjectActionDelegate {
+
+ private List<IFile> selectedFiles = new ArrayList<IFile>();
+ private List<IFolder> selectedFolders = new ArrayList<IFolder>();
+
+
+ public IncludeFileAction() {
+ super();
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ for (IFile file : selectedFiles) {
+ try {
+ file.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
+ } catch (CoreException x) {
+ Activator.log(IStatus.ERROR, "error setting exclude property on file: "+file.getName(), x);
+ }
+ }
+
+ for(IFolder folder : selectedFolders){
+ try{
+ folder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
+ includeFolder( folder);
+ }
+ catch (CoreException x) {
+ Activator.log(IStatus.ERROR, "error setting exclude property on folder: "+folder.getName(), x);
+ }
+ }
+ /*Refresh project tree when property is changed */
+ PlatformUI.getWorkbench().getDecoratorManager().update("com.nokia.wrt.decorator");
+ }
+
+ /**
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ selectedFiles.clear();
+ selectedFolders.clear();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator iter = ss.iterator(); iter.hasNext();) {
+ Object obj = iter.next();
+ if (obj instanceof IFile) {
+ IFile file = (IFile) obj;
+ selectedFiles.add(file);
+ }
+
+ if(obj instanceof IFolder){
+ IFolder folder = (IFolder) obj;
+ selectedFolders.add(folder);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param folder
+ * @throws CoreException
+ */
+
+ private void includeFolder(IFolder folder) throws CoreException{
+ folder.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ if (resource instanceof IFile) {
+ IFile file = (IFile) resource;
+ file.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
+ }
+ else if (resource instanceof IFolder) {
+ IFolder folder = (IFolder) resource;
+ folder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null);
+ }
+ return true;
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/PackageException.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import org.symbian.tools.wrttools.core.exception.WRTException;
+
+public class PackageException extends WRTException {
+
+ /**
+ * Default serial version ID
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Default constructor.
+ */
+ public PackageException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public PackageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public PackageException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public PackageException(Throwable cause) {
+ super(cause);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/PackagerFileManipulation.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.symbian.tools.wrttools.core.exception.WRTException;
+
+public class PackagerFileManipulation {
+
+ private Logger logger = Logger.getLogger(getClass().getName());
+ public PackagerFileManipulation() {
+ }
+
+ /**
+ * This method copies zip file from source folder to destination folder.
+ * @param sPath
+ * @param dPath
+ * @throws PackagerException
+ * @throws PackageException
+ * @throws IOException
+ * @throws WRTException
+ * @throws IOException
+ */
+ public void copyFile(String fromFileName, String toFileName) throws PackageException {
+ File fromFile = new File(fromFileName);
+ File toFile = new File(toFileName);
+ FileInputStream from = null;
+ FileOutputStream to = null;
+
+ if (!fromFile.exists())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_SOURCE_NOT_FOUND,
+ WRTPackagerConstants.ERR_SOURCE_NOT_FOUND);
+ if (fromFile.isDirectory())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_FILE_COPY_FAIL,
+ WRTPackagerConstants.ERR_FILE_COPY_FAIL);
+ if (!fromFile.canRead())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_UNREADABLE,
+ WRTPackagerConstants.ERR_UNREADABLE);
+
+ if (toFile.isDirectory())
+ toFile = new File(toFile, fromFile.getName());
+
+ if (toFile.exists()) {
+ if (!toFile.canWrite())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_NOT_WRITABLE,
+ WRTPackagerConstants.ERR_NOT_WRITABLE);
+
+ } else {
+ String parent = toFile.getParent();
+ if (parent == null)
+ parent = System.getProperty(PackagerMessages.getString("PackagerFileManipulation.useDir")); //$NON-NLS-1$
+ File dir = new File(parent);
+ if (!dir.exists())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_DEST_NOT_FOUND,
+ WRTPackagerConstants.ERR_DEST_NOT_FOUND);
+ if (dir.isFile())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_FILE_COPY_FAIL,
+ WRTPackagerConstants.ERR_FILE_COPY_FAIL);
+ if (!dir.canWrite())
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_NOT_WRITABLE,
+ WRTPackagerConstants.ERR_NOT_WRITABLE);
+ }
+
+ try {
+ from = new FileInputStream(fromFile);
+ to = new FileOutputStream(toFile);
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+
+ while ((bytesRead = from.read(buffer)) != -1)
+ to.write(buffer, 0, bytesRead); // write
+ } catch (FileNotFoundException e) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_READ_WRITE_FAIL,
+ e.getMessage());
+ } catch (IOException e) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_READ_WRITE_FAIL,
+ e.getMessage());
+ }
+ finally {
+ if (from != null)
+ try {
+ from.close();
+ } catch (IOException e) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_FILE_CLOSE_FAIL,
+ e.getMessage());
+ }
+ if (to != null)
+ try {
+ to.close();
+ } catch (IOException e) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_FILE_CLOSE_FAIL,
+ e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * This method is used for logging and exception handling
+ * @param lev -- severity Level
+ * @param logMessage -- message to log
+ * @param errException -- exception to throw
+ * @throws PackagerException
+ */
+ private void logAndThrowErrors(Level lev , String logMessage, String errException) throws PackageException {
+ logger.log(lev, logMessage);
+ throw new PackageException(errException);
+ }
+}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/PackagerMessages.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/PackagerMessages.java Tue Feb 02 08:17:07 2010 -0800
@@ -22,7 +22,7 @@
import java.util.ResourceBundle;
public class PackagerMessages {
- private static final String BUNDLE_NAME = "com.nokia.wrt.core.packager.packageMessages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.packager.packageMessages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/PackagerZipFolder.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,351 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+
+//import org.apache.commons.io.IOUtils;
+
+//import com.nokia.wrt.core.report.IMessageListener;
+//import com.nokia.wrt.core.report.Message;
+import org.symbian.tools.wrttools.core.status.IWRTConstants;
+import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
+import org.symbian.tools.wrttools.core.status.WRTStatus;
+import org.symbian.tools.wrttools.util.Util;
+
+/**
+ * A class is used to Zip folders and files in the same way as WinZip does.
+ * @author ranoliya
+ *
+ */
+class PackagerZipFolder {
+
+ //ZIP output stream
+ private ZipOutputStream pkgZipOutputStream = null;
+
+ //Logger to log info. errors and messages
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ //List of files to be zipped
+ private List<String> fileList;
+
+ //Status handler for status reporting to GUI
+ private IWRTStatusListener statusListener;
+
+ //Source path from where files are to be zipped
+ private String srcPath;
+
+ //Widget file to be zipped
+ private File wFile;
+
+ //package root folder path
+ private String rootFolderPath="";
+
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ /**
+ * This method creates a zip file for the given input at the given destination path
+ * @param srcpath - Input for the zip
+ * @param destPath - The destination path
+ * @param listOfFiles - list of files to be included in the zip. for null list it will zip all the files and folders
+ * @param statushandler - Status handler form GUI
+ * @throws PackageException - exception during Zipping
+ */
+ public void zipProjectFolder(String srcpath, String destPath, List<String> listOfFiles, IWRTStatusListener statushandler) throws PackageException{
+ fileList = listOfFiles;
+ this.statusListener = statushandler;
+ this.srcPath=srcpath;
+ try
+ {
+ wFile = new File (srcPath);
+ //invlid file or directory
+ if (!wFile.isFile() && !wFile.isDirectory()
+ || null == destPath || !(destPath.length()>0)) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_SOURCE_NOT_FOUND,null);
+ }
+
+ //create zip outputstream
+ FileOutputStream outzip=null;
+
+ outzip=new FileOutputStream(destPath);
+
+ pkgZipOutputStream = new ZipOutputStream(outzip);
+
+ zipFilesInFolder( wFile, rootFolderPath);
+
+
+ pkgZipOutputStream.finish();
+ pkgZipOutputStream.close();
+ }catch (IOException e){
+ e.printStackTrace();
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_ZIP_FAILED,e);
+ }
+
+ }
+
+ public void zipProjectFolder(String srcpath, String destPath, List<String> listOfFiles) throws PackageException{
+ fileList = listOfFiles;
+// this.statusListener = statushandler;
+ this.srcPath=srcpath;
+ try
+ {
+ wFile = new File (srcPath);
+ //invlid file or directory
+ if (!wFile.isFile() && !wFile.isDirectory()
+ || null == destPath || !(destPath.length()>0)) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_SOURCE_NOT_FOUND,null);
+ }
+
+ //create zip outputstream
+
+
+ pkgZipOutputStream = new ZipOutputStream(new FileOutputStream(destPath));
+ zipFilesInFolder( wFile, rootFolderPath);
+ pkgZipOutputStream.finish();
+ pkgZipOutputStream.close();
+ }catch (IOException e){
+ e.printStackTrace();
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_ZIP_FAILED,e);
+ }
+
+ }
+
+
+ /**
+ * This method scans one by one files inside the srcPath and
+ * add it to the zip folder
+ * Method is called recursively to add each file of the folder to the Zip entry
+ * @param pkgFile -- File or folder to add to zip
+ * @param baseName -- name under which it will add the pkgFile
+ * @throws PackageException - exception from Zip
+ */
+ private void zipFilesInFolder(File pkgFile, String baseName) throws PackageException {
+
+ if (pkgFile.isDirectory()) {
+ File [] fList = pkgFile.listFiles() ;
+ if(fList.length>0){
+ //package selected files
+ if(null != fileList && fileList.size()>0){
+ for (int i=0; i< fList.length; i++){
+// System.out.println(i+" fileList name ----------------- :"+fileList.get(i));
+ rootFolderPath="";
+ retrieveFileName(fList[i]);
+ //if directory then call function to add all files in it
+ if(fList[i].isDirectory())
+ {
+ zipFilesInFolder(fList[i], baseName);
+ }
+ for(int j=0; j<fileList.size(); j++){
+ //if file is in list then zip it
+ String compareStr = rootFolderPath.concat(fList[i].getName().toString().trim());
+ if(compareStr.equals(fileList.get(j).toString())){
+ if(fList[i].exists()){
+ zipFilesInFolder( fList[i],fileList.get(j).toString()) ;
+ }
+ }
+ }
+ }
+ }
+ // package all the files if given fileList is null
+ else
+ {
+ for (int i=0; i< fList.length; i++){
+ if(fList[i].exists())
+ zipFilesInFolder( fList[i],baseName) ;
+ }
+ }
+ }
+ }
+ // Add a file to the zip entry
+ else {
+ //Discard .wgz files from packaging
+ String name = pkgFile.getName();
+ String compare ="";
+ if(name.length()>3 && null!= name){
+ String tempStr = name.substring(name.length()-4, name.length());
+ compare = tempStr;
+ }
+
+ //Discard .wgz file
+ if(compare.length()>0 && compare.equalsIgnoreCase(".wgz")){
+ logger.log(Level.INFO, ".wgz file discarded for Package: "+name);
+ reportStatus(MessageFormat.format(PackagerMessages.getString("package.discard.wgz")
+ ,new Object[] {name}));
+ }
+ else{
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(pkgFile);
+
+ ZipEntry zipEntry = new ZipEntry(baseName);
+ pkgZipOutputStream.putNextEntry(zipEntry);
+
+
+// System.out.println("Copy >>>-->> ");
+ try{
+ copy(fis, pkgZipOutputStream);
+
+// IOUtils.copy(fis, pkgZipOutputStream);
+// IOUtils.copyLarge(fis, pkgZipOutputStream);
+
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+
+ }
+// System.out.println("Copy <<----<< ");
+
+ pkgZipOutputStream.closeEntry();
+ fis.close();
+ } catch (IOException e) {
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_ZIP_FAILED,e);
+ }
+ finally{
+ try {
+ pkgZipOutputStream.closeEntry();
+ fis.close();
+ } catch (IOException e) {
+ logAndThrowErrors(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * retrieve file name from source folder to current path
+ * @param file
+ */
+ private void retrieveFileName(File file) {
+ if(null !=file.getParent()){
+ rootFolderPath=file.getParentFile().getName().toString().trim().concat("/") //$NON-NLS-1$
+ .concat(rootFolderPath);
+ //if it reaches to package source filder then return
+// if(file.getParentFile().getName().toString().trim().equals(wFile.getName())){
+ if(file.getParentFile().getAbsolutePath().toString().trim()
+ .equalsIgnoreCase(wFile.getAbsolutePath())){
+ return;
+ }
+ else{
+ retrieveFileName(file.getParentFile());
+ }
+ }
+
+ }
+
+
+ /**
+ * Reporting status to the GUI
+ * @param statusMessage - message to be delivered
+ */
+ public void reportStatus(String statusMessage) {
+ WRTStatus status = new WRTStatus();
+ status.setStatusSource(IWRTConstants.StatusSourceType.PACKAGER.name());
+ status.setStatusDescription(statusMessage);
+ statusListener.emitStatus(status);
+
+
+ }
+ /**
+ * This method is used for logging and exception handling
+ * @param lev -- severity Level
+ * @param logMessage -- message to log
+ * @param e -- exception to throw, if its not an exception then it should be null
+ * @throws PackagerException
+ */
+ private void logAndThrowErrors(Level lev , String logMessage, Exception e) throws PackageException {
+ logger.log(lev, logMessage);
+ reportStatus(WRTPackagerConstants.STA_PKG_FAILED);
+ //for exceptions log error message and stack trace
+ if(null!=e){
+ Util.logEvent(logger, Level.SEVERE, e);
+ throw new PackageException(e);
+ }
+ }
+/**
+ *
+ * @param input
+ * @param output
+ * @return
+ * @throws IOException
+ */
+
+ public static int copy(InputStream input, OutputStream output) throws IOException {
+
+ long count = copyLarge(input, output);
+ if (count > Integer.MAX_VALUE) {
+ return -1;
+ }
+
+ return (int) count;
+ }
+
+ /**
+ * Copy bytes from a large (over 2GB) <code>InputStream</code> to an
+ * <code>OutputStream</code>.
+ * <p>
+ * This method buffers the input internally, so there is no need to use a
+ * <code>BufferedInputStream</code>.
+ *
+ * @param input the <code>InputStream</code> to read from
+ * @param output the <code>OutputStream</code> to write to
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ *
+ * */
+ public static long copyLarge(InputStream input, OutputStream output)
+ throws IOException {
+
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ long count = 0;
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) {
+ output.write(buffer, 0, n);
+ count += n;
+ }
+
+ return count;
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WidgetPackager.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,352 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.symbian.tools.wrttools.core.status.IWRTConstants;
+import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
+import org.symbian.tools.wrttools.core.status.WRTStatus;
+import org.symbian.tools.wrttools.core.status.WRTStatusHandler;
+import org.symbian.tools.wrttools.util.Util;
+
+/**
+ * This is the main class for core component Packager.
+ * This class reads from the given source file and creates widget package at
+ * the given destination path
+ * @author ranoliya
+ *
+ */
+public class WidgetPackager implements IWRTPackager {
+
+ // source path for packager
+ private String srcPath = "";
+
+ //destination path for packager
+ private String destPath = "";
+
+ //name of the package
+ private String packageName = "";
+
+ //list of files to package
+ private List<String> listOfFiles ;
+
+ //status handler for creating status listener
+ private WRTStatusHandler statusHandler;
+
+ private IWRTStatusListener statusListener;
+
+ //Logger to log errors and info
+ private Logger logger = Logger.getLogger(getClass().getName());
+
+ private String errorMessage = "";
+
+ /**
+ * Class Constructor the packaging process
+ */
+ public WidgetPackager(IWRTStatusListener wrtStatusListener) {
+ statusHandler = new WRTStatusHandler();
+ statusHandler.addListener(wrtStatusListener);
+ statusListener = wrtStatusListener;
+ }
+
+ /**
+ * Method packages the input folder, Initial step for Packaging
+ * @param sPath -- Project Source path
+ * @param dPath -- Package destination path
+ * @param fileList -- List of files to be included in the package
+ * @throws PackageException
+ */
+ public void packageWidget(String sPath, String dPath,List<String> fileList) throws PackageException
+ {
+ if(null != sPath || null != dPath){
+
+ listOfFiles = new ArrayList<String>();
+ this.listOfFiles = fileList;
+
+ sPath = Util.replaceChar(sPath, File.separatorChar, '/');
+ this.srcPath = sPath;
+ reportStatus(WRTPackagerConstants.STA_PKG_START);
+ if(!validateFilesToPackage()){
+
+ reportStatus(WRTPackagerConstants.STA_PKG_FAILED);
+ errorMessage = PackagerMessages.getString("package.missing.mandatory.files");
+ throw new PackageException(PackagerMessages.getString("package.missing.mandatory.files"));
+
+ }
+ // if destination path is not specified
+ if(dPath.equals("")){ //$NON-NLS-1$
+ dPath=sPath;
+ }
+ this.packageName=new File(dPath).getName();
+ File destDir = new File(dPath);
+ dPath = destDir.getParentFile().getAbsolutePath().concat("/");
+ this.destPath = Util.replaceChar(dPath, File.separatorChar, '/');
+
+
+ initPackage();
+ }
+ else
+ {
+ reportStatus(WRTPackagerConstants.LOG_NULL_INPUT);
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_NULL_INPUT, null);
+ }
+ }
+
+ /**
+ * This is the packager invocation method that calls packager main API
+ * @throws PackagerException
+ */
+ private void initPackage() throws PackageException {
+ File destFile = new File(destPath);
+ if(!destFile.canWrite() || !destFile.exists()|| (destFile.exists() && destFile.isFile())){ // to avoid considering file as existing dir
+ boolean success = destFile.mkdir();
+ if(!success){
+ reportStatus(WRTPackagerConstants.ERR_DIR_CREATE_FAIL);
+ reportStatus(WRTPackagerConstants.STA_PKG_FAILED);
+ throw new PackageException();
+// return;
+ }
+ }
+
+
+ int fileType = checkInputType();
+
+ String srcStatus = MessageFormat.format(PackagerMessages.getString("WidgetPackager.WidgetPackager.filesFrom")
+ ,new Object[]{srcPath});
+
+
+
+ reportStatus(srcStatus);
+
+ boolean pass = createWidgetPackage(fileType);
+ if(pass){
+ String destStatus = MessageFormat.format(PackagerMessages.getString("WidgetPackager.WidgetPackager.fileDest")
+ ,new Object[]{destPath.concat(packageName)});
+ reportStatus(destStatus);
+ reportStatus(WRTPackagerConstants.STA_PKG_PASSED);
+ }
+ }
+
+
+ /**
+ * This method checks for the user input for Packager and returns File Type
+ * @return int -- File Type
+ * @throws PackagerException
+ */
+ public int checkInputType() throws PackageException {
+ int fileType = 2;
+ File checkInput ;
+
+ checkInput = new File(srcPath);
+ if(checkInput.exists()){
+
+ // user input for packaging is project directory
+ if (checkInput.isDirectory()) {
+ fileType = 1;
+ }
+
+ // user input is unknown to packager - report to status
+ else {
+ fileType = 2;
+
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_UNSUPPORTED_INPUT,null);
+ }
+ }
+ return fileType;
+ }
+
+ /**
+ * This method returns the Destination path for the packaged widget
+ * @return
+ */
+ public String getDestPath() {
+ return destPath;
+ }
+
+ /**
+ * Reporting status
+ * @param statusMessage
+ */
+ public void reportStatus(String statusMessage) {
+ WRTStatus status = new WRTStatus();
+ status.setStatusSource(IWRTConstants.StatusSourceType.PACKAGER.name());
+ status.setStatusDescription(statusMessage);
+ statusListener.emitStatus(status);
+ }
+
+ /**
+ * This method is used for logging and exception handling
+ * @param lev -- severity Level
+ * @param logMessage -- message to log
+ * @param e -- exception to throw, if its not an exception then it should be null
+ * @throws PackagerException
+ */
+ private void logAndThrowErrors(Level lev , String logMessage, Exception e) throws PackageException {
+ logger.log(lev, logMessage);
+
+ //for exceptions log error message and stack trace
+ if(null!=e){
+ reportStatus(WRTPackagerConstants.STA_PKG_FAILED);
+ Util.logEvent(logger, Level.SEVERE, e);
+ throw new PackageException(e);
+ }
+ }
+
+ /**
+ * This method creates Widget package-- overridden
+ * @param - Input file type
+ */
+ private boolean createWidgetPackage(int fileType) throws PackageException {
+ String widgetPath= "";
+ String zipPath = "";
+ boolean sucess = false;
+ boolean packageDone = false;
+ PackagerZipFolder zipFolder = new PackagerZipFolder();
+
+ widgetPath = destPath.concat(packageName); //$NON-NLS-1$
+ File reWrite = new File(widgetPath);
+ if(reWrite.exists())
+ reWrite.delete();
+ //if source path and destination path are same
+ if(srcPath.equals(destPath)){
+ // Project folder as an input
+ if (fileType==1){
+ zipPath = destPath.concat("tmpwid.zip"); //$NON-NLS-1$
+ zipFolder.zipProjectFolder(srcPath, zipPath,listOfFiles,statusListener);
+// zipFolder.zipProjectFolder(srcPath, zipPath,listOfFiles);
+
+ }
+ //unsupported file type
+ else{
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_UNSUPPORTED_INPUT,null);
+ }
+ }
+ else {
+ if (fileType==1){
+ zipPath = destPath.concat("tmpwid.zip");//$NON-NLS-1$
+// zipFolder.zipProjectFolder(srcPath,zipPath,listOfFiles,statusListener );
+ zipFolder.zipProjectFolder(srcPath, zipPath,listOfFiles);
+ }
+ else{
+ logAndThrowErrors(Level.SEVERE, WRTPackagerConstants.LOG_UNSUPPORTED_INPUT, null);
+ }
+ }
+
+ //rename file
+ //created zip file
+ File zFile = new File(zipPath);
+
+
+ //new package name to use for rename appended wgz. This logic should be removed from package zip folder.
+ File newFile = new File(widgetPath+".wgz");
+
+ //delete .wgz if already exists
+ if(newFile.exists()){
+ newFile.delete();
+ }
+ //rename file
+ if(zFile.exists()){
+ sucess = zFile.renameTo(newFile);
+ }
+ //overwrite the existing file
+ if(!sucess)
+ {
+ logAndThrowErrors(Level.WARNING, PackagerMessages.getString("WidgetPackager.fileOverwriteMsg"),null);
+ }
+
+ File tempZip = new File(zipPath);
+ //delete temp file if exists
+ if(tempZip.exists())
+ {
+ tempZip.delete();
+ }
+ packageDone = true;
+ return packageDone;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * This method validates basic files (.html and .plist) checked in packaging option tree
+ * @return -- mandatory files exists or not
+ */
+ private boolean validateFilesToPackage(){
+ boolean isPlist = false;
+ boolean isHtml = false;
+ File srcDir = new File(srcPath);
+ String plistFile = srcDir.getName().concat("/info.plist");
+
+ if(listOfFiles.size()>0 && null != listOfFiles){
+ for (String fileName : listOfFiles) {
+ try{
+ if (fileName.equalsIgnoreCase(plistFile)) {
+ isPlist = true;
+ }
+ int len = fileName.lastIndexOf("/");
+ String fName=fileName.substring(len+1, fileName.length());
+// files with out extention will have index out of bound exception
+ int extLen = fName.lastIndexOf('.');
+ String extention = "";
+ if(extLen > 0){
+ extention = fName.substring(extLen, fName.length());
+ }
+
+ String htmlFile = srcDir.getName().concat("/").concat(fName);
+ if(htmlFile.equalsIgnoreCase(fileName) &&
+ (extention.equalsIgnoreCase(".htm")|| extention.equalsIgnoreCase(".html"))){
+ isHtml = true;
+ }
+
+ if(isPlist && isHtml){
+ return true;
+ }
+ }
+ // files with out extention will have index out of bound exception
+// try catch will catch that and will proceed to the next file in the
+// for loop
+ catch(Exception e){
+// e.printStackTrace();
+ }
+ }
+ }
+ String srcStatus = MessageFormat.format(PackagerMessages.getString("WidgetPackager.WidgetPackager.filesFrom")
+ ,new Object[]{srcPath});
+ reportStatus( srcStatus);
+ if(!isPlist ){
+ reportStatus( WRTPackagerConstants.ERR_PKG_MAN_PLIST_FILE_MISSING);
+
+ }
+ if(!isHtml){
+ reportStatus( WRTPackagerConstants.ERR_PKG_MAN_HTML_FILE_MISSING);
+
+ }
+
+ return (isPlist && isHtml);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/WrtPackageActionDelegate.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,201 @@
+/**
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+
+package org.symbian.tools.wrttools.core.packager;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionDelegate;
+
+import org.symbian.tools.wrttools.Activator;
+import org.symbian.tools.wrttools.WRTStatusListener;
+import org.symbian.tools.wrttools.core.status.IWRTStatusListener;
+
+import org.symbian.tools.wrttools.core.status.IWRTConstants;
+import org.symbian.tools.wrttools.core.status.WRTStatus;
+import org.symbian.tools.wrttools.core.validator.ValidateAction;
+
+public class WrtPackageActionDelegate extends ActionDelegate implements
+ IObjectActionDelegate {
+
+
+ /**
+ * @see ActionDelegate#run(IAction)
+ */
+
+ private final List<IProject> projectList = new ArrayList<IProject>();
+
+
+ public void run(IAction action) {
+ PlatformUI.getWorkbench().saveAllEditors(true);
+ if (projectList != null && projectList.size() > 0) {
+ for (IProject project : projectList) {
+ if (project != null) {
+ packageProject( project);
+ }
+ }
+ }
+ }
+
+ public boolean packageProject(IProject project) {
+ boolean packaedSucess=false;
+ if (project != null) {
+
+ ValidateAction validator = new ValidateAction();
+ if(!validator.isValidProject(project)) {
+ System.out.println("Invalid widget, can not be packaged!");
+ reportStatus("For the project "+ project.getLocation());
+ reportStatus(WRTPackagerConstants.STA_PKG_FAILED);
+ reportStatus("See errors from the Problems View for more details...");
+ return packaedSucess;
+ }
+
+ try {
+ final List<String> fileList = new ArrayList<String>();
+ //--->>
+ project.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ if (resource instanceof IFile) {
+ IFile file = (IFile) resource;
+ boolean add = true;
+ // skip user-excluded and automatically-excluded files
+ String value = file.getPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY);
+ if (value != null) {
+ add = false;
+ }
+ String name = file.getName();
+ // skip Aptana temporarily generated files
+ if (name.startsWith(".tmp_")) {
+ add = false;
+ }
+ //Bug fix when import project with different name was unable to package it
+ if(name.endsWith(".wgz")){
+ add = false;
+ }
+ if (add) {
+ if(file.getProject().getLocation().toString().endsWith(file.getProject().getName())){
+ fileList.add(file.getLocation().toString().substring(file.getProject().getLocation().toString().length()-file.getProject().getName().length()));
+ }
+ else{
+ String projectDir=file.getProject().getLocation().toString().substring(file.getProject().getLocation().toString().lastIndexOf("/")+1);
+ String fullpath=file.getFullPath().toString();
+ fullpath=fullpath.substring(fullpath.indexOf(file.getProject().getName())+file.getProject().getName().length());
+ fullpath=projectDir+fullpath;
+ fileList.add(fullpath);
+
+ }
+ }
+ }
+ return true;
+ }
+ });
+ //<<--<<
+
+ String projectPath = project.getLocation().toString();
+ String prjName = project.getName();
+ String dprojectPath = projectPath+"/"+prjName;
+ WRTStatusListener statusListener = new WRTStatusListener();
+ WidgetPackager widgetPackager = new WidgetPackager(statusListener);
+
+ try {
+ IProgressMonitor pm = new NullProgressMonitor();
+ // deleting the previous build --->>
+ IPath wgzPath = new Path(project.getName()+".wgz");
+ IFile wgz = project.getFile(wgzPath);
+ //do not delete the here, delete only if packaging is success
+ /*if (wgz.exists()) {
+ wgz.delete(true, false, pm);
+ }*/
+ widgetPackager.packageWidget(projectPath, dprojectPath, fileList);
+ packaedSucess=true;
+ project.refreshLocal(IResource.DEPTH_ONE, pm);
+ wgz = project.getFile(wgzPath);
+ if (wgz.exists()) {
+ wgz.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
+ }
+
+ } catch (PackageException e) {
+ Activator.log(IStatus.ERROR, "Error packaging widget archive", e);
+ } finally {
+ statusListener.close();
+ }
+ } catch (CoreException x) {
+ Activator.log(IStatus.ERROR, "Error packaging widget archive", x);
+ }
+
+ }
+ return packaedSucess;
+ }
+ /**
+ * Reporting status
+ * @param statusMessage
+ */
+ private void reportStatus(String statusMessage) {
+ WRTStatus status = new WRTStatus();
+ WRTStatusListener statusListener = new WRTStatusListener();
+ status.setStatusSource(IWRTConstants.StatusSourceType.PACKAGER.name());
+ status.setStatusDescription(statusMessage);
+ statusListener.emitStatus(status);
+ }
+ @SuppressWarnings("unchecked")
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ projectList.clear();
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator iter = ss.iterator(); iter.hasNext();) {
+
+ Object obj = iter.next();
+ if (obj instanceof IProject) {
+ projectList.add((IProject) obj);
+
+ }
+ }
+ }
+ }
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+ }
+
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/packager/packageMessages.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,42 @@
+WidgetPackager.pathAppend=\\
+WidgetPackager.WidgetPackager.filesFrom=Packaging Files from : "{0}"
+WidgetPackager.WidgetPackager.fileDest=Packaged files to destination\: "{0}"
+WRTPackagerConstants.success=Packaging Successful\n
+WRTPackagerConstants.failed=Packaging Failed\n
+WRTPackagerConstants.inProgress=Packaging in Progress...
+WRTPackagerConstants.started=Packaging Started...
+WRTPackagerConstants.nullpera=Input parameters are NULL
+WRTPackagerConstants.nullInput=Selected input is NULL -- Invalid input
+WRTPackagerConstants.directoryCreateErr=Can not create output directory
+WRTPackagerConstants.checkPermission=Can not create specified directory at the destination.
+WRTPackagerConstants.unSupportedInput=Any input other then a folder is not supported
+WRTPackagerConstants.InputNotSupported=Input type not supported by WRT Packager
+WRTPackagerConstants.renameFailed=Packager failed while renaming a .zip file
+WRTPackagerConstants.failureGenerate=Packager failed while generating package files
+WRTPackagerConstants.srcNotFound=Source folder not found
+WRTPackagerConstants.inputSourceNotFound=Input source not Found
+WRTPackagerConstants.srcNotReadable=Package source is not readable
+WRTPackagerConstants.unReadable=Unreadable Input, Please check Source and Destination
+WRTPackagerConstants.canNotcopy=Can not copy file
+WRTPackagerConstants.copyErr=Packager can not copy required files
+WRTPackagerConstants.NoDestination=Destination directory does not exists
+WRTPackagerConstants.noLocateDest=Packager could not locate destination directory
+WRTPackagerConstants.destNotWritable=Destination directory is not writable
+WRTPackagerConstants.destNotwritableErr=packager can not write to destination directory, check permissions
+WRTPackagerConstants.readWriteFail=File read/write Failed
+WRTPackagerConstants.readWritePermission=Packager read/write failed, check for permissions
+WRTPackagerConstants.closeFile=Can not close files
+WRTPackagerConstants.closeFileerr=Package could not close files
+WRTPackagerConstants.ZipFailed=File Zipping failed
+WRTPackagerConstants.packFailed=Packager could not perform packaging, File I/O not available for zip utility
+WRTPackagerConstants.emptyInputFolder=Input project folder is empty
+WRTPackagerConstants.emptyFolderErr=Input project folder is empty, Please give a valid source folder
+PackagerFileManipulation.useDir=user.dir
+
+package.missing.mandatory.files = Please select mandatory files
+package.discard.wgz = \nDiscarded already packaged file - "{0}" ... \n
+
+WRTPackagerConstants.package.missing.mandatory.files.plist = Mandatory Plist file is Misssing
+WRTPackagerConstants.package.missing.mandatory.files.html = Mandatory Html file is Missing
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/report/messages.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,12 @@
+HtmlReportHandler.convert.title=Dashboard widget conversion report
+HtmlReportHandler.convert.description=Automatic conversions performed by the converter to match Nokia Web Runtime.
+HtmlReportHandler.analysis.report.title=Dashboard widget analysis report
+HtmlReportHandler.analysis.report.description=This analysis report lists the mandatory or optional conversions needed to port the widget to Nokia Web Runtime.
+HtmlReportHandler.file.name=File name
+HtmlReportHandler.line.number=Line number
+HtmlReportHandler.convert.action.needed=Action needed
+HtmlReportHandler.description.column=Description
+HtmlReportHandler.severity.info.column=Severity
+
+HtmlReportHandler.keyword.entry = \ Entry
+HtmlReportHandler.add.project = ADD Project
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/status/Messages.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/status/Messages.java Tue Feb 02 08:17:07 2010 -0800
@@ -23,7 +23,7 @@
import java.util.ResourceBundle;
public class Messages {
- private static final String BUNDLE_NAME = "com.nokia.wrt.core.status.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.status.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/status/messages.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,13 @@
+IWRTConstants.validator=Validator
+IWRTConstants.packager=Packager
+IWRTConstants.deployer=Deployer
+IWRTConstants.converter=Converter
+
+IWRTConstants.report.error = Error
+IWRTConstants.report.warning = Warning
+IWRTConstants.report.fatal = Fatal
+IWRTConstants.report.information = Information
+IWRTConstants.report.success = Success
+IWRTConstants.report.mandatory = Mandatory
+IWRTConstants.report.optional = Optional
+
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/Messages.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/Messages.java Tue Feb 02 08:17:07 2010 -0800
@@ -23,7 +23,7 @@
import java.util.ResourceBundle;
public class Messages {
- private static final String BUNDLE_NAME = "com.nokia.wrt.core.validator"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.validator"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/ValidatorPropMessages.java Tue Feb 02 08:16:15 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/ValidatorPropMessages.java Tue Feb 02 08:17:07 2010 -0800
@@ -27,11 +27,11 @@
import org.symbian.tools.wrttools.util.Util;
public class ValidatorPropMessages {
- private static final String BUNDLE_NAME = "com.nokia.wrt.core.validator.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.symbian.tools.wrttools.core.validator.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
- private static Logger log = Logger.getLogger("com.nokia.wrt.core.validator.ValidatorPropMessages");
+ private static Logger log = Logger.getLogger("org.symbian.tools.wrttools.core.validator.ValidatorPropMessages");
private ValidatorPropMessages() {
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/WidgetProjectValidator.java Tue Feb 02 08:16:15 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,466 +0,0 @@
-/**
- * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-
-package org.symbian.tools.wrttools.core.validator;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.osgi.framework.Bundle;
-
-import org.symbian.tools.wrttools.sdt.utils.DefaultMessageListener;
-import org.symbian.tools.wrttools.sdt.utils.FileUtils;
-import org.symbian.tools.wrttools.sdt.utils.MessageLocation;
-import org.symbian.tools.wrttools.sdt.utils.VariableSubstitutionEngine;
-import org.symbian.tools.wrttools.Activator;
-import org.symbian.tools.wrttools.core.exception.ValidationException;
-import org.symbian.tools.wrttools.core.packager.WRTPackagerConstants;
-import org.symbian.tools.wrttools.core.widgetmodel.WidgetModel;
-import org.symbian.tools.wrttools.previewer.preview.PreviewSupport;
-
-public class WidgetProjectValidator {
-
- static final String INFO_PLIST = "info.plist";
- boolean previewMainCreated = false;
- private IProject project;
- private WidgetModel model = null;
-
- public static final String BUILDER_ID = "org.symbian.tools.wrttools.core.validator.widgetProjectValidator";
-
- public WidgetProjectValidator() {
- super();
- ValidateAction validator = new ValidateAction();
- validator.isValidProject(project);
- //return null;
- }
- void checkResource(IResource resource, IProject project ) {
- if (resource instanceof IFile) {
- try {
- if(!previewMainCreated ) {
- //createEmptyPreviewMainHTML();
- createPreviewFrameHTML(project);
-
- }
- //if info.plist modified
- if (isInfoPList(resource)) {
- // did a change to info.plist result in a different main html file?
-
- IResource prevMainHTML = null;
- String mainHtmlName = project.getPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY);
- if (mainHtmlName != null) {
- prevMainHTML = project.findMember(mainHtmlName, false);
- }
- model = null;
- IFile currMainHTML = getMainHTMLFromModel(project);
-
- if ( currMainHTML != null){
- if(!currMainHTML.equals(prevMainHTML)) {
- updateHTMLPreview(currMainHTML);
-
- }
- }
- else{
- createEmptyPreviewMainHTML(project);
- project.setPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY, null);
- }
-
-
- }
- else{
- IFile currMainHTML = getMainHTMLFromModel(project);
- String mainHtmlPath = project.getPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY);
- if(mainHtmlPath == null){
- if (currMainHTML != null && !currMainHTML.equals(resource)) {
- updateHTMLPreview(currMainHTML);
- }
- }
- else if (mainHtmlPath.equals(resource.getProjectRelativePath().toString())) {
- updateHTMLPreview((IFile)resource);
-
- }
- }
- } catch (CoreException e) {
- Activator.log(IStatus.ERROR, "Error building resource:"+resource.getFullPath().toString(), e);
- } catch (IOException e) {
- Activator.log(IStatus.ERROR, "Error building resource:"+resource.getFullPath().toString(), e);
- } catch (URISyntaxException e) {
- Activator.log(IStatus.ERROR, "Error building resource:"+resource.getFullPath().toString(), e);
- }
- }
- }
-
- private void updateHTMLPreview(IFile htmlFile) throws CoreException, IOException, URISyntaxException {
- createPreviewMainHTML(getMainHTML(project));
- //createPreviewFrameHTML();
-
- }
-
- protected void updatePreviewFiles(IProject project)
- throws CoreException {
- final List<String> filesToPackage = new ArrayList<String>();
- try {
- updatePreviewSupportFiles(project);
- project.accept(new IResourceVisitor() {
-
- public boolean visit(IResource resource) throws CoreException {
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- boolean add = true;
- // skip user-excluded and automatically-excluded files
- String value = file
- .getPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY);
- if (value != null) {
- add = false;
- }
- String name = file.getName();
- // skip Aptana temporarily generated files
- if (name.startsWith(".tmp_")) {
- add = false;
- }
- // if(name.endsWith(".wgz")){
- // add = false;
- // }
- if (name.equals("Thumbs.db")) {
- add = false;
- }
- if (add) {
- if (file.getProject().getLocation().toString()
- .endsWith(file.getProject().getName())) {
-
- filesToPackage.add(file.getLocation()
- .toString().substring(
- file.getProject().getLocation()
- .toString().length()
- - file.getProject()
- .getName()
- .length()));
- } else {
- String projectDir = file.getProject()
- .getLocation().toString().substring(
- file.getProject().getLocation()
- .toString()
- .lastIndexOf("/") + 1);
- String fullpath = file.getFullPath().toString();
- fullpath = fullpath.substring(fullpath
- .indexOf(file.getProject().getName())
- + file.getProject().getName().length());
- fullpath = projectDir + fullpath;
- filesToPackage.add(fullpath);
-
- }
- }
- }
- return true;
- }
- });
- } catch (CoreException x) {
- Activator.log(IStatus.ERROR, "Error updating widget preview", x);
- }
- }
-
- private boolean isInfoPList(IResource resource) {
- return INFO_PLIST.equalsIgnoreCase(resource.getProjectRelativePath().toString());
- }
-
- private IFile getMainHTML(IProject project) {
- IFile result = null;
- try {
- String mainHtmlName = project.getPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY);
- if (mainHtmlName != null) {
- IResource resource = project.findMember(mainHtmlName, false);
- if (resource != null && resource instanceof IFile) {
- result = (IFile) resource;
- } else {
- project.setPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY, null);
- }
- }
- if (result == null) {
- result = getMainHTMLFromModel(project);
- }
- } catch (CoreException x) {
- Activator.log(IStatus.ERROR, "error getting main html property", x);
- }
- return result;
- }
-
- private IFile getMainHTMLFromModel(IProject project) {
- IFile result = null;
- if(model == null)
- model = getModel(project);
- String mainHtml = model.getMainHtml();
- if(mainHtml != null) {
- IResource resource = project.findMember(mainHtml, false);
- if (resource != null && resource instanceof IFile) {
- try {
- project.setPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY, mainHtml);
- result = (IFile) resource;
- }catch (CoreException x) {
- Activator.log(IStatus.ERROR, "error setting file persistent property", x);
- }
- }else{
- try {
- project.setPersistentProperty(PreviewSupport.MAIN_HTML_PROPERTY, null);
- result = (IFile) resource;
- }catch (CoreException x) {
- Activator.log(IStatus.ERROR, "error setting file persistent property", x);
- }
- }
- }
- return result;
- }
-
- private WidgetModel getModel(IProject project) {
- WidgetModel model = new WidgetModel();
- String path = project.getLocation().toString();
- model.setWidgetDirectory(path);
- try {
- model.getWidgetModel(new File(path));
- } catch (ValidationException x) {
- Activator.log(IStatus.ERROR, "invalid widget", x);
- }
- return model;
- }
-
- private String readFileIntoString(File file) throws CoreException, FileNotFoundException {
- InputStream is = new FileInputStream(file);
- return new String(FileUtils.readInputStreamContents(is, "UTF-8"));
- }
-
- private void setFileFromString(IFile file, String contents) throws UnsupportedEncodingException, CoreException {
- ByteArrayInputStream is = new ByteArrayInputStream(contents.getBytes("UTF-8"));
- if (!file.exists()) {
- file.create(is, true, new NullProgressMonitor());
- } else {
- file.setContents(is, true, false, new NullProgressMonitor());
- }
- }
-
- private void updatePreviewSupportFiles(IProject project) {
- try {
- PreviewSupport ps = new PreviewSupport(project);
- IFolder previewFolder = ps.getPreviewFolder();
- IProgressMonitor progressMonitor = new NullProgressMonitor();
- IProject projects[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-
- if (previewFolder.exists()) {
- // Use File-based utility since IFolder.delete doesn't always delete subfolders
- FileUtils.delTree(previewFolder.getLocation().toFile());
- previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- for(int u=0; u < projects.length; u++){
- projects[u].refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- }
- if(!previewFolder.isSynchronized(IResource.DEPTH_INFINITE)){
- for(int u=0; u < projects.length; u++){
- projects[u].refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.getParent().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- //No need to delete empty folder, we will reuse the same folder for copying new files and sub folders into this.
- //previewFolder.delete(IResource.FORCE|IFolder.INCLUDE_TEAM_PRIVATE_MEMBERS|IContainer.INCLUDE_PHANTOMS, progressMonitor);
-
- if(!previewFolder.isSynchronized(IResource.DEPTH_INFINITE)){
- for(int u=0; u < projects.length; u++){
- projects[u].refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.getParent().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- // No need to create preview folder as we are using existing empty preview folder and copying into that
- //previewFolder.create(true, false, progressMonitor);
-
- if(!previewFolder.isSynchronized(IResource.DEPTH_INFINITE)){
- for(int u=0; u < projects.length; u++){
- projects[u].refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.getParent().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.setDerived(true);
-
- File destRootDir = previewFolder.getLocation().toFile();
- copyPreviewFiles("/preview", "/preview", destRootDir);
- //previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- //previewFolder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
- if(!previewFolder.isSynchronized(IResource.DEPTH_INFINITE)){
- for(int u=0; u < projects.length; u++){
- projects[u].refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.getParent().refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- previewFolder.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
- }
- previewFolder.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
-
-
- previewFolder.accept(new IResourceVisitor() {
- public boolean visit(IResource r) {
- try {
- // inhibit packaging for preview files
- r.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
- // inhibit version control for preview files
- r.setDerived(true);
- } catch (CoreException x) {
- Activator.log(IStatus.ERROR, "error setting packager property on "+r.getFullPath().toString(), x);
- }
- return true;
- }
- });
- }
- catch (IOException x) {
- Activator.log(IStatus.ERROR, "Error updating preview support files", x);
- } catch (CoreException x) {
- Activator.log(IStatus.ERROR, "Error updating preview support files", x);
- }
- }
-
- private void copyPreviewFiles(String sourceRootDir, String topRootDir, File destRootDir) throws IOException, CoreException {
- Bundle bundle = Activator.getDefault().getBundle();
- Enumeration e = bundle.getEntryPaths(sourceRootDir);
- if (e != null) {
- while (e.hasMoreElements()) {
- String path = (String) e.nextElement();
- // paths indicating subdirectories end with '/'.
- if (path.endsWith("/")) {
- // need to trim first component off path, which is the base preview dir
- IPath destPath = new Path(path);
- destPath = destPath.removeFirstSegments(1);
- File newDir = new File(destRootDir, destPath.toString());
- newDir.mkdirs();
- copyPreviewFiles(path, topRootDir, destRootDir);
- } else {
- // skip PREVIEW_HTML_TEMPLATE, we don't copy to preview folder
- IPath destPath = new Path(path);
- destPath = destPath.removeFirstSegments(1);
- File newFile = new File(destRootDir, destPath.toString());
- if (!newFile.getName().equals(PreviewSupport.PREVIEW_HTML_TEMPLATE)) {
- InputStream is = openBundleFile(new Path(path));
- FileUtils.copyFile(is, newFile);
- }
- }
- }
- }
- }
-
- private InputStream openBundleFile(IPath path) throws IOException {
- InputStream is = FileLocator.openStream(Activator.getDefault().getBundle(),
- path, false);
- return is;
- }
-
- private void createPreviewFrameHTML(IProject project) throws IOException, CoreException, URISyntaxException {
-
- PreviewSupport ps = new PreviewSupport(project);
- InputStream templateStream = openBundleFile(ps.getPreviewFrameTemplate());
- String templateText = new String(FileUtils.readInputStreamContents(templateStream, null));
-
- Map<String, String> vars = new HashMap<String,String>();
- String previewBasePath = PreviewSupport.PREVIEW_FOLDER + "/";
- vars.put("preview_base", previewBasePath);
- VariableSubstitutionEngine engine = new VariableSubstitutionEngine(
- new DefaultMessageListener(),
- new MessageLocation(ps.getProject(), 0, 0));
- engine.setVariableToken('(');
- String resultText = engine.substitute(vars, templateText);
-
- IFile previewFrame = ps.getPreviewFrameHtml();
- boolean updateProperty = !previewFrame.exists();
- setFileFromString(previewFrame, resultText);
- if (updateProperty) {
- previewFrame.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
- }
- previewFrame.setDerived(true);
- }
-
- private void createEmptyPreviewMainHTML(IProject project) throws CoreException, UnsupportedEncodingException, FileNotFoundException {
- if(previewMainCreated)
- return;
-
- previewMainCreated = true;
- PreviewSupport ps = new PreviewSupport(project);
-
- IFile previewMainHtml = ps.getPreviewMainHtml();
-
- setFileFromString(previewMainHtml, "");
- previewMainHtml.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
- previewMainHtml.setDerived(true);
-
- }
-
- private void createPreviewMainHTML(IFile src) throws CoreException, UnsupportedEncodingException, FileNotFoundException {
-
- PreviewSupport ps = new PreviewSupport(project);
- File inputFile = src.getLocation().toFile();
- String contents = readFileIntoString(inputFile);
- Pattern headPattern = Pattern.compile("<head\\b[^>]*>", Pattern.CASE_INSENSITIVE|Pattern.MULTILINE);
-
- String previewBasePath = PreviewSupport.PREVIEW_FOLDER;
- StringBuffer buf = new StringBuffer();
- buf.append("\t<script language=\"JavaScript\" type=\"text/javascript\" src=\"" + previewBasePath + "/script/lib/loader.js\"></script>\n");
- String previewScripts = buf.toString();
-
- Matcher matcher = headPattern.matcher(contents);
- if (matcher.find()) {
- String replacement = "<head>\n" + previewScripts;
- contents = matcher.replaceFirst(replacement);
- } else {
- Pattern bodyPattern = Pattern.compile("<body\\b[^>]*>", Pattern.CASE_INSENSITIVE|Pattern.MULTILINE);
- matcher = bodyPattern.matcher(contents);
- if (matcher.find()) {
- String replacement = "\n" + previewScripts + "<body>";
- contents = matcher.replaceFirst(replacement);
- }
- }
-
- IFile previewMainHtml = ps.getPreviewMainHtml();
- setFileFromString(previewMainHtml, contents);
- previewMainHtml.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString());
- previewMainHtml.setDerived(true);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/validator/messages.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,134 @@
+plist.File.Not.Present=Mandatory file info.plist is missing in the widget project. For further processing please include info.plist and try again.
+html.File.Not.Present=Main HTML file is missing. For further processing please include the main html file and try again.
+WidgetModel.Divergent.Files.Present=Unnecessary files are included. To minimize the widget size please only include the required files. The supported file types are .htm, .html, .png, .gif, .jpg.
+
+todo.WidgetModel.Divergent.Files.Present=Remove the unsupported file
+
+todo.include.plist=Please include the info.plist file to the project
+todo.include.html=Please include the html file to the project
+
+plist.html.element.mismatch= HTML element for the key MainHTML in Info.plist differs from the actual HTML file Name . Please correct the plist file for the MainHTML key.
+
+todo.correct.plist =Correct Plist Entry for MainHTML
+plist.html.element.mailHtml.missing =HTML Element MainHTML in Info.plist is not present or the previous tag was not closed properly . Please correct the plist file for the MainHTML key.
+
+todo.correct.plist.for.html =Correct Plist Entry for MainHTML
+
+plist.mankey.mising =Mandatory Plist element
+not.in.plist.file=not in plist file. Please add plist element values to the info.plist file.
+todo.add.mankey.plist.element =Add the mandatory Plist element values to Info.plist.
+contains.invalid.character =contains invalid characters
+todo.valid.character=Enter valid character to Info.plist.
+
+plist.key.string.mising =Missing string pair for the key element. Please add the string element for the key.
+todo.add.mankey.string =Add the string element of mandatory Info.plist key element
+
+plist.element.not.closed =A malformed XML element was found. Please delete or change the plist element from info.plist file.
+todo.element.not.closed = Delete or change the Plist element from Info.plist
+
+plist.element.not.supported=An unsupported Info.plist element was found. Please delete or add a valid info.plist element.
+todo.plist.element.not.Valid =Add a valid Info.plist element
+
+WidgetModel.File.NotDirectory=Error validating a widget project directory. The input is not a directory or does not exist.
+
+todo.widgetmodel =Please add a widget project which contains the mandatory files Info.plist and the main HTML file.
+
+WidgetModel.File.NotZipFile =The project is not of Widget Type.
+
+widget.validation.complete =Widget validation succeeded. There were no errors.
+
+widget.project.not.selected =Please select a widget project to validate.
+
+no.html.element=The HTML file is empty or invalid HTML. Please verify html file and try again.
+todo.no.html.element =Verify html file.
+
+todo.correct.html.tag =Correct the HTML tag at line
+
+no.plist.element=The Info.plist file does not contain any valid plist elements. Please add elements to the plist file.
+todo.no.plist.element =Add elements to the plist.
+## These are not being used anymore should delete
+## It looks like these are used with string concatenation. Replace with strings using MessageFormat
+project.dir.more.plist.file.present=More than one Plist file is present in the project directory, extra plist file count is :
+todo.project.dir.more.plist.file.present=Verify all the plist files and remove the extra ones
+project.inner.dir.more.plist.file.present=Plist files detected in inner directories count is:
+todo.project.inner.dir.more.plist.file.present=Remove Plist File from the subdirectory.
+
+initialize.messagemanager = Message Manager must be initialized
+validate.man.file.started =Mandatory files validation started
+validate.man.file.finished =Validating mandatory files complete.
+validate.plist.started =Info.plist validation started
+validate.plist.finished =Info.plist validation complete.
+
+validate.html.started =HTML validation started
+validate.html.finished=HTML validation complete.
+
+## It looks like these are used with string concatenation. Replace with strings using MessageFormat
+more.outer.html.File.Present.and.count.is=Extra HTML files are present in project directory, count is :
+more.inner.html.File.Present.and.count.is= Html files are present in inner directory, count is :
+
+todo.more.outer.html.File.Present.and.count.is=Extra HTML files are present in project directory. Verify and remove, count is :
+todo.more.inner.html.File.Present.and.count.is=Html files are present in inner directory. Verify and remove, count is :
+
+xml.declaration.error.missing.close= XML declaration missing close '>'. Please close the tag.
+xml.declaration.error.missing.open= XML declaration missing open'<'. Please close the tag.
+xml.declaration.error.missing.open.and.close= XML declaration missing open'<' and close'>'. Please verify.
+
+todo.xml.declaration.error.missing.close= XML declaration missing close '>'
+todo.xml.declaration.error.missing.open= XML declaration missing open'<'
+todo.xml.declaration.error.missing.open.and.close= XML declaration missing open'<' and close'>'
+
+xml.doctype.error.missing.close=XML doctype missing close '>'
+xml.doctype.error.missing.open=XML doctype missing open'<'
+xml.doctype.error.missing.open.and.close= XML doctype missing open'<' and close'>'
+
+todo.xml.doctype.error.missing.close=XML doctype missing close '>'
+todo.xml.doctype.error.missing.open=XML doctype missing open'<'
+todo.xml.doctype.error.missing.open.and.close=XML doctype missing open'<' and close'>'
+
+xml.element.error.missing.close=XML start element missing close'>'
+xml.element.error.missing.open=XML start element missing open'<'
+xml.element.error.missing.open.and.close=XML start element missing open'<' and close'>'
+
+todo.xml.element.error.missing.close=XML start element missing close'>'
+todo.xml.element.error.missing.open=XML start element missing open'<'
+todo.xml.element.error.missing.open.and.close=XML start element missing open'<' and close'>'
+
+
+xml.element.end.error.missing.close=XML end element missing close'>
+xml.element.end.error.missing.open=XML end element missing open'<'
+xml.element.end.error.missing.open.and.close=XML end element missing open'<' and close'>'
+
+todo.xml.element.end.error.missing.close=XML end element missing close'>'
+todo.xml.element.end.error.missing.open=XML end element missing open'<'
+todo.xml.element.end.error.missing.open.and.close= XML end element missing open'<' and close'>'
+
+char.present.before.start.line= Invalid Character present before Starting of document
+todo.char.present.before.start.line=Remove Invalid Character present
+
+plist.parser.error.at.line.no= Plist Parse Error at line number :
+todo.plist.parser.error.at.line.no= Verify Plist Element at line number
+non.referenced.html.File.Present=Non referenced Html File Present. To minimize the widget size please only include the required files.
+todo.non.referenced.html.File.Present= Verify Non referenced Html File
+duplicate.plist.file.present=Duplicate plist file detected in the widget project. To minimize the widget size please only include the required files.
+subfolder.duplicate.plist.file.present = More Plist files are present in the project sub directory. Please include only required files.
+
+todo.duplicate.plist.file.present= Remove Duplicate plist file
+plist.File.Not.selected= Plist File is not selected from package option.
+todo.plist.File.Not.selected Plist file needs to be selected for packaging
+
+html.File.Not.selected= Html file is not selected from package option.
+todo.html.File.Not.selected=Main Html needs to be selected for packaging
+
+widgetmodel.plist.notpresent = info.plist is not present in the widget project.
+widgetmodel.html.notpresent = main html is not present in the widget project.
+
+validation.sucess = Validation is success without any errors.
+conversion.sucess= Partial conversion is completed.
+WidgetModel.refrenced.html.missing=Refrenced html file not present
+plist.parsing.error.mainHtmlkey.missing= While parsing plist, main html key is missing or incorrect.
+xml.element.not.closed = The element not closed, please close the element and try again.
+xml.empty.element.not.closed = The element not closed properly, please close the element and try again.
+xml.close.element.not.opened = The closed element not Opened , please verify.
+plist.parsing.error.mainHtmlkey.missing= While parsing plist, main html key is missing or incorrect.
+todo.xml.element.not.closed=XML element not closed
+todo.xml.empty.element.not.closed=Empty element not close
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/previewer/preview/PreviewSupport.java Tue Feb 02 08:16:15 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/**
- * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-
-package org.symbian.tools.wrttools.previewer.preview;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
-
-import org.symbian.tools.wrttools.sdt.utils.Check;
-import org.symbian.tools.wrttools.sdt.utils.TrackedResource;
-
- /**
- * This class encapsulates the creation and naming
- * of the preview folder and support files
- * @author dpodwall
- *
- */
-public class PreviewSupport {
-
- public static final String PREVIEW_FOLDER = "preview";
- public static final String PREVIEW_MAIN_HTML = "wrt_preview_main.html";
- public static final String PREVIEW_FRAME_HTML = "wrt_preview_frame.html";
- public static final String PREVIEW_HTML_TEMPLATE = "wrt_preview.html";
- public static final QualifiedName MAIN_HTML_PROPERTY = new QualifiedName("org.symbian.tools.wrttools", "mainHTML");
- //public static final String PREVIEW_BROWSER_NAME1 = "WRT Widget (S60)";
- public static final String PREVIEW_BROWSER_NAME = "Web Runtime (WRT)";
-
- private TrackedResource projectTracker;
-
- public PreviewSupport(IProject project) {
- Check.checkArg(project);
- this.projectTracker = new TrackedResource(project);
- }
-
- public void dispose() {
- if (projectTracker != null) {
- projectTracker.dispose();
- }
- }
-
- public IProject getProject() {
- return projectTracker.getProject();
- }
-
- /**
- * Returns the folder containing preview support files, creating it
- * if needed.
- * @throws CoreException
- */
- public IFolder getPreviewFolder() throws CoreException {
- IFolder result = getProject().getFolder(PREVIEW_FOLDER);
- if (!result.exists()) {
- result.create(true, true, new NullProgressMonitor());
- }
- return result;
- }
-
- /**
- * Returns the main file, which is a copy of the user's main html
- * file. The copy is modified to include the widget preview environment
- * JavaScript files.
- * The returned IFile may not exist yet
- * @throws CoreException
- */
- public IFile getPreviewMainHtml() throws CoreException {
- IFile result = getProject().getFile(PREVIEW_MAIN_HTML);
- return result;
- }
-
- /**
- * Returns the preview file, which is the outermost html
- * file of the preview environment. It includes the main
- * file in an iframe.
- * The returned IFile may not exist yet
- * @throws CoreException
- */
- public IFile getPreviewFrameHtml() throws CoreException {
- IFile result = getProject().getFile(PREVIEW_FRAME_HTML);
- return result;
- }
- public IFile getMainHtml() throws CoreException {
- IFile result = null;
- String mainFilePath = getProject().getPersistentProperty(MAIN_HTML_PROPERTY);
- if (mainFilePath != null) {
- IResource resource = getProject().findMember(mainFilePath);
- if (resource instanceof IFile) {
- result = (IFile) resource;
- }
- }
- return result;
- }
-
- /**
- * Returns the base path for preview support files
- * in the plugin
- * @return
- */
- public IPath getPreviewPluginBase() {
- return new Path("preview");
- }
-
- public IPath getPreviewFrameTemplate() {
- return getPreviewPluginBase().append(PREVIEW_HTML_TEMPLATE);
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/.classpath Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="C:/Documents and Settings/TasneemS/eclipse/workspace/s60.nokia.com.WRTKit_1.0.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/.project Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.symbian.wrtools.doc.WRTKit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/.settings/org.eclipse.jdt.core.prefs Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,8 @@
+#Wed Jan 27 16:56:27 PST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/META-INF/MANIFEST.MF Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: WRTKit
+Bundle-SymbolicName: org.symbian.wrtools.doc.WRTKit
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.symbian.wrtools.lib.wrtkit.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/build.properties Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.wrtools.doc.WRTKit/src/org/symbian/wrtools/lib/wrtkit/Activator.java Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,50 @@
+package org.symbian.wrtools.lib.wrtkit;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.wrtools.lib.WRTKit";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/buildcron Tue Feb 02 08:17:07 2010 -0800
@@ -0,0 +1,5 @@
+# mail any output to ‘paul’, no matter whose crontab this is
+MAILTO=johnk@symbian.org
+# run at 10 pm
+0 22 * * 0-5 sh /home/symbian/wrttools/scripts/shepard.sh > /home/symbian/scratch/build-`date +%j`.out 2>&1
+
--- a/scripts/genBuildScripts.xml Tue Feb 02 08:16:15 2010 -0800
+++ b/scripts/genBuildScripts.xml Tue Feb 02 08:17:07 2010 -0800
@@ -2,6 +2,8 @@
<!-- WS_DIR is set in the associated shell scripts -->
<property environment="env"/>
<echo message="workspace: ${env.WS_DIR}"/>
+ <property name="source" value="1.5" />
+ <property name="target" value="1.5" />
<eclipse.buildScript
elements="feature@org.symbian.tools.wrttools"
buildDirectory="${env.WS_DIR}"