001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.gwt.client.dnd;
029
030/**
031 * Drag and drop controller.<p>
032 *
033 * Implement and assign to the {@link CmsDNDHandler} to control the drag process as well as the underlying model.<p>
034 *
035 * @since 8.0.0
036 */
037public interface I_CmsDNDController {
038
039    /**
040     * Executed when end animation starts.<p>
041     *
042     * @param draggable the draggable item
043     * @param target the current drop target
044     * @param handler the drag and drop handler instance
045     */
046    void onAnimationStart(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
047
048    /**
049     * Executed before drop.<p>
050     *
051     * @param draggable the draggable item
052     * @param target the current drop target
053     * @param handler the drag and drop handler instance
054     *
055     * @return <code>false</code> to cancel dropping
056     */
057    boolean onBeforeDrop(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
058
059    /**
060     * Executed on drag cancel.<p>
061     *
062     * @param draggable the draggable item
063     * @param target the current drop target
064     * @param handler the drag and drop handler instance
065     */
066    void onDragCancel(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
067
068    /**
069     * Executed on drag start.<p>
070     *
071     * @param draggable the draggable item
072     * @param target the current drop target
073     * @param handler the drag and drop handler instance
074     *
075     * @return <code>false</code> to cancel dragging
076     */
077    boolean onDragStart(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
078
079    /**
080     * Executed on drop.<p>
081     *
082     * @param draggable the draggable item
083     * @param target the current drop target
084     * @param handler the drag and drop handler instance
085     */
086    void onDrop(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
087
088    /**
089     * Executed after the placeholder has been positioned inside a drop target.<p>
090     *
091     * @param draggable the draggable item
092     * @param target the current drop target
093     * @param handler the drag and drop handler instance
094     */
095    void onPositionedPlaceholder(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
096
097    /**
098     * Executed when the helper is dragged into a drop target.<p>
099     *
100     * @param draggable the draggable item
101     * @param target the current drop target
102     * @param handler the drag and drop handler instance
103     *
104     * @return <code>false</code> to cancel entering target (placeholder will not positioned inside target)
105     */
106    boolean onTargetEnter(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
107
108    /**
109     * Executed when the helper is dragged out of a drop target.<p>
110     *
111     * @param draggable the draggable item
112     * @param target the current drop target
113     * @param handler the drag and drop handler instance
114     */
115    void onTargetLeave(I_CmsDraggable draggable, I_CmsDropTarget target, CmsDNDHandler handler);
116}