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/user/notifications/client/view/switchbutton/SwitchButton.ui.xml b/src/main/java/org/gcube/portlets/user/notifications/client/view/switchbutton/SwitchButton.ui.xml
deleted file mode 100644
index 0f7241f..0000000
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/switchbutton/SwitchButton.ui.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- OFF
-
-
-
- ON
-
-
-
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java
index 1cda6e3..35d7ce7 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java
+++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.java
@@ -8,8 +8,8 @@ import java.util.HashMap;
import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
-import org.gcube.portlets.user.notifications.client.view.switchbutton.SwitchButton;
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
+import org.gcube.portlets.widgets.switchbutton.client.SwitchButton;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.ui.xml b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.ui.xml
index 16e7722..372f145 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.ui.xml
+++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/CategoryWrapper.ui.xml
@@ -1,6 +1,6 @@
diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java
index 2456fc5..1b976d0 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java
+++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.java
@@ -7,8 +7,8 @@ import java.util.ArrayList;
import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
-import org.gcube.portlets.user.notifications.client.view.switchbutton.SwitchButton;
import org.gcube.portlets.user.notifications.shared.NotificationPreference;
+import org.gcube.portlets.widgets.switchbutton.client.SwitchButton;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
diff --git a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
index 9e139f7..9fda583 100644
--- a/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
+++ b/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/NotificationPreferenceView.ui.xml
@@ -1,7 +1,7 @@
diff --git a/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml b/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml
index 85fee8a..c48e90f 100644
--- a/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml
+++ b/src/main/resources/org/gcube/portlets/user/notifications/Notifications.gwt.xml
@@ -9,10 +9,10 @@
-
+