44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
|
package org.gcube.portlets.user.notifications.client.view.templates;
|
||
|
|
||
|
import static com.google.gwt.query.client.GQuery.$;
|
||
|
|
||
|
import com.google.gwt.core.client.GWT;
|
||
|
import com.google.gwt.dom.client.Style.Unit;
|
||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||
|
import com.google.gwt.query.client.Function;
|
||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||
|
import com.google.gwt.uibinder.client.UiField;
|
||
|
import com.google.gwt.user.client.Timer;
|
||
|
import com.google.gwt.user.client.Window;
|
||
|
import com.google.gwt.user.client.ui.Composite;
|
||
|
import com.google.gwt.user.client.ui.FocusPanel;
|
||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||
|
import com.google.gwt.user.client.ui.Widget;
|
||
|
|
||
|
public class SlidingButton extends Composite {
|
||
|
|
||
|
private static SlidingButtonUiBinder uiBinder = GWT
|
||
|
.create(SlidingButtonUiBinder.class);
|
||
|
|
||
|
interface SlidingButtonUiBinder extends UiBinder<Widget, SlidingButton> {
|
||
|
}
|
||
|
|
||
|
@UiField FocusPanel switchContainer;
|
||
|
@UiField Div switcherButton;
|
||
|
|
||
|
public SlidingButton() {
|
||
|
initWidget(uiBinder.createAndBindUi(this));
|
||
|
switchContainer.addClickHandler(new ClickHandler() {
|
||
|
@Override
|
||
|
public void onClick(ClickEvent event) {
|
||
|
//switcherButton.getElement().getStyle().setLeft(-1, Unit.PX);
|
||
|
//// Animate the switch
|
||
|
// this.button.animate({ left: newLeft }, 250, "easeInOutCubic");
|
||
|
$(switcherButton).animate("left: -1", 250);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|