All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.future.earth.gwt.client.ui.button.TouchActionButton Maven / Gradle / Ivy

The newest version!
package eu.future.earth.gwt.client.ui.button;

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.user.client.ui.Image;

import eu.future.earth.gwt.client.ui.actionevent.ActionEvent;
import eu.future.earth.gwt.client.ui.actionevent.ActionHandler;
import eu.future.earth.gwt.client.ui.actionevent.HasActionHandlers;
import eu.future.earth.gwt.client.ui.popup.PopupRenderer;

public class TouchActionButton extends TouchPopupButton implements HasActionHandlers {


	public TouchActionButton(String newText, Image newImage, PopupRenderer newRenderer, UiType forTouch) {
		super(newText, newImage, newRenderer, forTouch);
		initWidget();
	}


	public TouchActionButton(String newText, PopupRenderer newRenderer, UiType forTouch) {
		super(newText, newRenderer, forTouch);
		initWidget();
	}


	public TouchActionButton(String newText, Image newImage, PopupRenderer newRenderer) {
		super(newText, newImage, newRenderer);
		initWidget();
	}


	public TouchActionButton(String newText, PopupRenderer newRenderer) {
		super(newText, newRenderer);
		initWidget();
	}

	private void initWidget() {
		super.addValueChangeHandler(new ValueChangeHandler() {

			@Override
			public void onValueChange(ValueChangeEvent event) {
				fireActionEvent(event.getValue());
			}
		});
	}

	private void fireActionEvent(D action) {
		ActionEvent.fire(this, action);
	}

	@Override
	public HandlerRegistration addActionHandler(ActionHandler handler) {
		return super.addHandler(handler, ActionEvent.getType());
	}




}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy