diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..2a71d10
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..7f79ce5
--- /dev/null
+++ b/.project
@@ -0,0 +1,59 @@
+
+
+ switch-button-widget
+ switch-button-widget project
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+ com.google.gdt.eclipse.core.webAppProjectValidator
+
+
+
+
+ com.google.gwt.eclipse.core.gwtProjectValidator
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.maven.ide.eclipse.maven2Nature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+ com.google.gwt.eclipse.core.gwtNature
+
+
diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope
new file mode 100644
index 0000000..ba3c245
--- /dev/null
+++ b/.settings/.jsdtscope
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/com.google.appengine.eclipse.core.prefs b/.settings/com.google.appengine.eclipse.core.prefs
new file mode 100644
index 0000000..82c36af
--- /dev/null
+++ b/.settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=
diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs
new file mode 100644
index 0000000..621bf8d
--- /dev/null
+++ b/.settings/com.google.gdt.eclipse.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+jarsExcludedFromWebInfLib=
+lastWarOutDir=/Users/massi/Documents/workspace/switch-button-widget/target/switch-button-widget-1.0.0-SNAPSHOT
+warSrcDir=src/main/webapp
+warSrcDirIsOutput=false
diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs
new file mode 100644
index 0000000..c803c44
--- /dev/null
+++ b/.settings/com.google.gwt.eclipse.core.prefs
@@ -0,0 +1,5 @@
+#Thu Jun 16 11:14:17 CEST 2011
+eclipse.preferences.version=1
+entryPointModules=
+filesCopiedToWebInfLib=gwt-servlet.jar
+gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..29abf99
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..69c31cd
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+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.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..6d08f4d
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..7895606
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100644
index 0000000..3bd5d0a
--- /dev/null
+++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/.settings/org.maven.ide.eclipse.prefs b/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..dae95d4
--- /dev/null
+++ b/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Thu Sep 02 10:42:12 CEST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/SwitchButtonTest-dev.launch b/SwitchButtonTest-dev.launch
new file mode 100644
index 0000000..f6e9446
--- /dev/null
+++ b/SwitchButtonTest-dev.launch
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SwitchButtonTest-prod.launch b/SwitchButtonTest-prod.launch
new file mode 100644
index 0000000..306f4f9
--- /dev/null
+++ b/SwitchButtonTest-prod.launch
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distro/INSTALL b/distro/INSTALL
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/distro/INSTALL
@@ -0,0 +1,2 @@
+
+
diff --git a/distro/LICENSE b/distro/LICENSE
new file mode 100644
index 0000000..cdb5851
--- /dev/null
+++ b/distro/LICENSE
@@ -0,0 +1,7 @@
+gCube System - License
+------------------------------------------------------------
+
+The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
+The software and documentation is provided by its authors/distributors "as is" and no expressed or
+implied warranty is given for its use, quality or fitness for a particular case.
+
diff --git a/distro/MAINTAINERS b/distro/MAINTAINERS
new file mode 100644
index 0000000..680cebb
--- /dev/null
+++ b/distro/MAINTAINERS
@@ -0,0 +1,6 @@
+Mantainers
+-------
+
+* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa,
+ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
+
diff --git a/distro/README b/distro/README
new file mode 100644
index 0000000..35f8e6d
--- /dev/null
+++ b/distro/README
@@ -0,0 +1,35 @@
+The gCube System - Welcome Tour Widget
+------------------------------------------------------------
+
+This work is partially funded by the European Commission in the
+context of the iMarine project (www.i-marine.eu), under the 1st call of FP7 IST priority.
+
+Authors
+-------
+Massimiliano Assante
+*
+Version and Release Date
+------------------------
+Janaury 2013 1.1
+
+
+Description
+-----------
+gCube Workspace Mail Widget is a GWT Widget that can be used for sending Messages from your gCube Portlet.
+
+Download information
+--------------------
+Source code is available from SVN:
+https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/wsmail-widget
+
+Binaries can be downloaded from:
+http://software.d4science.research-infrastructures.eu/
+
+Documentation
+-------------
+Documentation is available on-line from the Projects Documentation Wiki:
+
+Licensing
+---------
+
+This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
diff --git a/distro/changelog.xml b/distro/changelog.xml
new file mode 100644
index 0000000..ea2ec93
--- /dev/null
+++ b/distro/changelog.xml
@@ -0,0 +1,5 @@
+
+
+maven groupid renamed
+
+
diff --git a/distro/descriptor.xml b/distro/descriptor.xml
new file mode 100644
index 0000000..c468f13
--- /dev/null
+++ b/distro/descriptor.xml
@@ -0,0 +1,48 @@
+
+ servicearchive
+
+ tar.gz
+
+ /
+
+
+ ${distroDirectory}
+ /
+ true
+
+ README
+ LICENSE
+ INSTALL
+ MAINTAINERS
+ changelog.xml
+
+ 755
+ true
+
+
+ target/apidocs
+ /${artifactId}/doc/api
+ true
+ 755
+
+
+
+
+
+ ./
+ true
+
+
+
+ /${artifactId}
+
+
+
+ /${artifactId}
+ true
+
+
+
\ No newline at end of file
diff --git a/distro/profile.xml b/distro/profile.xml
new file mode 100644
index 0000000..d108a47
--- /dev/null
+++ b/distro/profile.xml
@@ -0,0 +1,25 @@
+
+
+
+ Library
+
+ gCube WS Mail Widget
+ PortletsWidgets
+ ${artifactId}
+ ${version}
+
+
+ ${artifactId}
+ ${version}
+
+ ${groupId}
+ ${artifactId}
+ ${version}
+
+
+ ${build.finalName}.jar
+
+
+
+
+
diff --git a/distro/svnpath.txt b/distro/svnpath.txt
new file mode 100644
index 0000000..edacb04
--- /dev/null
+++ b/distro/svnpath.txt
@@ -0,0 +1 @@
+${scm.url}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..59ed72b
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,197 @@
+
+ 4.0.0
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+
+
+ org.gcube.portlets.widgets
+ switch-button-widget
+ jar
+ 1.0.0-SNAPSHOT
+ gCube Switch Button Widget
+
+ gCube Switch Button Widget is a GWT Widget that can be used as a Checbox with a iOS sliding effect.
+
+
+ scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+ scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+ http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}
+
+
+
+ 2.5.1
+ distro
+
+ 1.6
+ 1.6
+ UTF-8
+ UTF-8
+
+
+
+
+ org.gcube.distribution
+ maven-portal-bom
+ LATEST
+ pom
+ import
+
+
+
+
+
+
+ com.google.gwt
+ gwt-user
+
+ provided
+
+
+
+ xerces
+ xercesImpl
+ 2.9.1
+ provided
+
+
+ org.gcube.portlets.user
+ gcube-widgets
+
+
+ com.googlecode.gwtquery
+ gwtquery
+ 1.3.3
+
+
+
+
+
+ src/main/java
+
+ **/*.*
+
+
+
+
+
+ maven-compiler-plugin
+
+
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ test-jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.5
+
+
+ copy-profile
+ install
+
+ copy-resources
+
+
+ target
+
+
+ ${distroDirectory}
+ true
+
+ profile.xml
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2
+
+
+ ${distroDirectory}/descriptor.xml
+
+
+
+ fully.qualified.MainClass
+
+
+
+
+
+ servicearchive
+ install
+
+ single
+
+
+
+
+
+
+ org.codehaus.mojo
+ gwt-maven-plugin
+ ${gwtVersion}
+
+
+
+ com.google.gwt
+ gwt-user
+ ${gwtVersion}
+
+
+ com.google.gwt
+ gwt-dev
+ ${gwtVersion}
+
+
+
+
+
+ prepare-package
+
+ resources
+ compile
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/widgets/switchbutton/SwitchButton.gwt.xml b/src/main/java/org/gcube/portlets/widgets/switchbutton/SwitchButton.gwt.xml
new file mode 100644
index 0000000..0e250b8
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/switchbutton/SwitchButton.gwt.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.java b/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.java
new file mode 100644
index 0000000..ef3c6b7
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.java
@@ -0,0 +1,132 @@
+package org.gcube.portlets.widgets.switchbutton.client;
+
+import static com.google.gwt.query.client.GQuery.$;
+
+import org.gcube.portlets.user.gcubewidgets.client.elements.Div;
+import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.query.client.css.CSS;
+import com.google.gwt.query.client.css.Length;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.HasName;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.Widget;
+
+public class SwitchButton extends Composite implements HasName, HasValue{
+
+ private static SwitchButtonUiBinder uiBinder = GWT
+ .create(SwitchButtonUiBinder.class);
+
+ interface SwitchButtonUiBinder extends UiBinder {
+ }
+ @UiField FocusPanel switchContainer;
+ @UiField Div switcherButton;
+ @UiField Span labelOff;
+ @UiField Span labelOn;
+ private String name;
+ private Boolean value;
+ private Boolean valueChangeHandlerInitialized = Boolean.FALSE;
+
+ public SwitchButton() {
+ name = DOM.createUniqueId();
+ initWidget(uiBinder.createAndBindUi(this));
+ value = false;
+ $(switcherButton).css(CSS.LEFT.with(Length.px(-1)));
+ ensureDomEventHandlers();
+ }
+
+ public SwitchButton(boolean initialValue) {
+ this();
+ setValue(initialValue);
+ }
+
+ @Override
+ public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) {
+ // Is this the first value change handler? If so, time to add handlers
+ if (!valueChangeHandlerInitialized) {
+ valueChangeHandlerInitialized = true;
+ }
+ return addHandler(handler, ValueChangeEvent.getType());
+ }
+
+ @Override
+ public Boolean getValue() {
+ return value;
+ }
+ /**
+ * Checks or unchecks the switch button box, firing {@link ValueChangeEvent} if
+ * appropriate.
+ *
+ * Note that this does not set the value property of the checkbox
+ * input element wrapped by this widget. For access to that property, see
+ * {@link #setFormValue(String)}
+ *
+ * @param value true to set on, false to set off; null value implies false
+ */
+ @Override
+ public void setValue(Boolean value) {
+ if (value == null) {
+ value = Boolean.FALSE;
+ }
+
+ Boolean oldValue = getValue();
+ if (value.equals(oldValue)) {
+ return;
+ }
+ this.value = value;
+ if (!value) {
+ $(switcherButton).animate("left: -1", 250);
+ labelOff.setStyleName("switch-button-label on");
+ labelOn.setStyleName("switch-button-label off");
+ } else {
+ $(switcherButton).animate("left: 12", 250);
+ labelOff.setStyleName("switch-button-label off");
+ labelOn.setStyleName("switch-button-label on");
+ }
+ }
+ /**
+ * Checks or unchecks the switch button box, firing {@link ValueChangeEvent} if
+ * appropriate.
+ *
+ *
+ * @param value true to set on, false to set off; null value implies false
+ * @param fireEvents If true, and value has changed, fire a
+ * {@link ValueChangeEvent}
+ */
+ @Override
+ public void setValue(Boolean value, boolean fireEvents) {
+ setValue(value);
+ if (fireEvents) {
+ ValueChangeEvent.fire(this, value);
+ }
+ }
+
+ protected void ensureDomEventHandlers() {
+ switchContainer.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ setValue(!value);
+ ValueChangeEvent.fire(SwitchButton.this, getValue());
+ }
+ });
+ }
+
+ @Override
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.ui.xml b/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.ui.xml
new file mode 100644
index 0000000..0f7241f
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/switchbutton/client/SwitchButton.ui.xml
@@ -0,0 +1,13 @@
+
+
+
+ OFF
+
+
+
+ ON
+
+
+
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/widgets/switchbutton/public/switchbutton.css b/src/main/java/org/gcube/portlets/widgets/switchbutton/public/switchbutton.css
new file mode 100644
index 0000000..28ee543
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/switchbutton/public/switchbutton.css
@@ -0,0 +1,54 @@
+/* Switch Button */
+
+.switch-button-label {
+ float: left;
+
+ font-size: 10pt;
+ cursor: pointer;
+}}
+
+.switch-button-label.off {
+ color: #adadad;
+}
+
+.switch-button-label.on {
+ color: #0088CC;
+}
+
+.switch-button-background {
+ float: left;
+ position: relative;
+
+ background: #ccc;
+ border: 1px solid #aaa;
+
+ margin: 1px 10px;
+
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+
+ cursor: pointer;
+
+ width: 25px;
+ height: 11px;
+
+ outline-style: none; /* this avoid the tabindex property to sorround this element with a (maybe dotted) rectangle*/
+}
+
+.switch-button-button {
+ position: absolute;
+
+ width: 12px;
+ height: 11px;
+
+ left: 12px;
+ top : -1px;
+
+ background: #FAFAFA;
+ border: 1px solid #aaa;
+
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
\ No newline at end of file
diff --git a/src/main/webapp/SwitchButton.css b/src/main/webapp/SwitchButton.css
new file mode 100644
index 0000000..7aca7ac
--- /dev/null
+++ b/src/main/webapp/SwitchButton.css
@@ -0,0 +1,34 @@
+/** Add css rules here for your application. */
+
+
+/** Example rules used by the template application (remove for your app) */
+h1 {
+ font-size: 2em;
+ font-weight: bold;
+ color: #777777;
+ margin: 40px 0px 70px;
+ text-align: center;
+}
+
+.sendButton {
+ display: block;
+ font-size: 16pt;
+}
+
+/** Most GWT widgets already have a style name defined */
+.gwt-DialogBox {
+ width: 400px;
+}
+
+.dialogVPanel {
+ margin: 5px;
+}
+
+.serverResponseLabelError {
+ color: red;
+}
+
+/** Set ids using widget.getElement().setId("idOfElement") */
+#closeButton {
+ margin: 15px 6px 6px;
+}
diff --git a/src/main/webapp/SwitchButton.html b/src/main/webapp/SwitchButton.html
new file mode 100644
index 0000000..2f10fc0
--- /dev/null
+++ b/src/main/webapp/SwitchButton.html
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+