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

eu.future.earth.gwt.client.date.week.whole.WholeDayPanelDropController Maven / Gradle / Ivy

There is a newer version: 3.3
Show newest version
package eu.future.earth.gwt.client.date.week.whole;

import com.allen_sauer.gwt.dnd.client.DragContext;
import com.allen_sauer.gwt.dnd.client.VetoDragException;
import com.allen_sauer.gwt.dnd.client.drop.AbstractDropController;

import eu.future.earth.gwt.client.date.EventPanel;
import eu.future.earth.gwt.client.date.week.DayEventpanel;

public class WholeDayPanelDropController extends AbstractDropController {

	public WholeDayPanelDropController(DayEventpanel newDropTarget) {
		super(newDropTarget);
	}

	@SuppressWarnings("unchecked")
	public void onDrop(DragContext context) {

		final DayEventpanel dropTarget = (DayEventpanel) getDropTarget();
		final EventPanel toMove = (EventPanel) context.draggable;
		// if(!dropTarget.isDay(toMove.getData())){
		dropTarget.addEventByDrop(toMove);
		// } else {
		// Edit ?
		// }
		super.onDrop(context);
	}

	@SuppressWarnings("unchecked")
	public void onPreviewDrop(DragContext context) throws VetoDragException {
		final DayEventpanel dropTarget = (DayEventpanel) getDropTarget();
		final EventPanel toMove = (EventPanel) context.draggable;
		if (dropTarget.isDay(toMove.getValue())) {
			throw new VetoDragException();
		}

		super.onPreviewDrop(context);

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy