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 030import org.opencms.gwt.client.dnd.CmsDNDHandler.Orientation; 031 032import com.google.gwt.dom.client.Element; 033 034/** 035 * Interface defining all methods needed for a drag and drop target. These will mostly be called by the drag and drop handler.<p> 036 * 037 * @since 8.0.0 038 */ 039public interface I_CmsDropTarget { 040 041 /** 042 * Returns true if the given cursor position is over the drop target.<p> 043 * 044 * @param x the cursor client x position 045 * @param y the cursor client y position 046 * @param orientation the drag and drop orientation 047 * 048 * @return <code>true</code> if the given cursor position is over the drop target 049 */ 050 boolean checkPosition(int x, int y, Orientation orientation); 051 052 /** 053 * Returns the drop target element.<p> 054 * This must be the element, where all children will be attached.<p> 055 * 056 * @return the element 057 */ 058 Element getElement(); 059 060 /** 061 * Returns the index of the placeholder or -1 if no placeholder is attached.<p> 062 * 063 * @return the index 064 */ 065 int getPlaceholderIndex(); 066 067 /** 068 * Inserts a new placeholder.<p> 069 * 070 * @param placeholder the placeholder element 071 * @param x the cursor client x position 072 * @param y the cursor client y position 073 * @param orientation the drag and drop orientation 074 */ 075 void insertPlaceholder(Element placeholder, int x, int y, Orientation orientation); 076 077 /** 078 * Executed on drop.<p> 079 * 080 * @param draggable the draggable being dropped 081 */ 082 void onDrop(I_CmsDraggable draggable); 083 084 /** 085 * Removes the placeholder.<p> 086 */ 087 void removePlaceholder(); 088 089 /** 090 * Repositions the placeholder.<p> 091 * 092 * @param x the cursor client x position 093 * @param y the cursor client y position 094 * @param orientation the drag and drop orientation 095 */ 096 void repositionPlaceholder(int x, int y, Orientation orientation); 097 098}