001package gwt.material.design.addins.client.dnd.base; 002 003/* 004 * #%L 005 * GwtMaterial 006 * %% 007 * Copyright (C) 2015 GwtMaterialDesign 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import com.google.gwt.event.shared.HandlerRegistration; 024import com.google.gwt.user.client.ui.Widget; 025import gwt.material.design.addins.client.dnd.constants.Restriction; 026import gwt.material.design.addins.client.dnd.events.DragEndEvent; 027import gwt.material.design.addins.client.dnd.events.DragMoveEvent; 028import gwt.material.design.addins.client.dnd.events.DragStartEvent; 029 030public interface HasDraggable { 031 032 /** 033 * Sets the target widget to apply draggable feature 034 * @param target 035 */ 036 void setTarget(Widget target); 037 038 /** 039 * Gets the draggable target 040 * @return 041 */ 042 Widget getTarget(); 043 044 /** 045 * Sets the ignoreFrom widget to exclude from dragging 046 * @param ignoreFrom 047 */ 048 void setIgnoreFrom(Widget ignoreFrom); 049 050 /** 051 * Sets the ignoreFrom as selector to exclude from dragging 052 * @param selector - can accept multiple selector separated by comma e.g. input, i, a, .content 053 */ 054 void setIgnoreFrom(String selector); 055 056 /** 057 * Gets the ignoreFrom widget 058 * @return 059 */ 060 Widget isIgnoreFrom(); 061 062 /** 063 * Sets the restriction properties of dnd feature 064 * @param restriction 065 * @see <a href="http://interactjs.io/docs/restriction/#restrict">Documentation</a> 066 */ 067 void setRestriction(Restriction restriction); 068 069 /** 070 * Gets the restriction properties 071 */ 072 Restriction getRestriction(); 073 074 /** 075 * Add a drag start handler 076 * @param handler 077 */ 078 HandlerRegistration addDragStartHandler(DragStartEvent.DragStartHandler handler); 079 080 /** 081 * Add a drag move handler 082 * @param handler 083 */ 084 HandlerRegistration addDragMoveHandler(DragMoveEvent.DragMoveHandler handler); 085 086 /** 087 * Add a drag end handler 088 * @param handler 089 */ 090 HandlerRegistration addDragEndHandler(DragEndEvent.DragEndHandler handler); 091 092 093}