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.ade.containerpage.client.ui;
029
030import org.opencms.gwt.client.dnd.I_CmsDropTarget;
031import org.opencms.gwt.client.dnd.I_CmsNestedDropTarget;
032import org.opencms.gwt.client.util.CmsPositionBean;
033
034import java.util.List;
035
036import com.google.gwt.user.client.ui.Widget;
037
038/**
039 * Interface for container page drop targets like containers and group-containers.<p>
040 */
041public interface I_CmsDropContainer extends I_CmsNestedDropTarget {
042
043    /**
044     * Adds a new child widget.<p>
045     *
046     * @param w the widget
047     *
048     * @see com.google.gwt.user.client.ui.HasWidgets#add(com.google.gwt.user.client.ui.Widget)
049     */
050    void add(Widget w);
051
052    /**
053     * Registers a child drop target.<p>
054     *
055     * @param child the child
056     */
057    void addDndChild(I_CmsDropTarget child);
058
059    /**
060     * Adopts a container-page element registering it as a child of this container.
061     * Used for elements that are already child nodes of the container-element node in DOM.<p>
062     *
063     * @param containerElement the element to adopt
064     */
065    void adoptElement(CmsContainerPageElementPanel containerElement);
066
067    /**
068     * Checks the maximum number of allowed elements and hides overflowing elements.<p>
069     */
070    void checkMaxElementsOnEnter();
071
072    /**
073     * Checks the maximum number of allowed elements and displays formerly hidden elements.<p>
074     */
075    void checkMaxElementsOnLeave();
076
077    /**
078     * Clears the list of child drop targets.<p>
079     */
080    void clearDnDChildren();
081
082    /**
083     * Returns the container id.<p>
084     *
085     * @return the container id
086     */
087    String getContainerId();
088
089    /**
090     * Returns the current position info.<p>
091     *
092     * @return the position info
093     */
094    CmsPositionBean getPositionInfo();
095
096    /**
097     * Gets the number of child widgets in this panel.<p>
098     *
099     * @return the number of child widgets
100     */
101    int getWidgetCount();
102
103    /**
104     * Gets the index of the specified child widget.<p>
105     *
106     * @param w the widget
107     *
108     * @return the index
109     */
110    int getWidgetIndex(Widget w);
111
112    /**
113     * Hides list collector direct edit buttons, if present.<p>
114     */
115    void hideEditableListButtons();
116
117    /**
118     * Puts a highlighting border around the container content.<p>
119     */
120    void highlightContainer();
121
122    /**
123     * Puts a highlighting border around the container content using the given dimensions.<p>
124     *
125     * @param positionInfo the highlighting position to use
126     */
127    void highlightContainer(CmsPositionBean positionInfo);
128
129    /**
130     * Inserts a child widget before the specified index.
131     * If the widget is already a child of this panel, it will be moved to the specified index.<p>
132     *
133     * @param w the new child
134     * @param beforeIndex the before index
135     */
136    void insert(Widget w, int beforeIndex);
137
138    /**
139     * Returns <code>true</code> if this container is a detail view only container.<p>
140     *
141     * @return <code>true</code> if this container is a detail view only container
142     */
143    boolean isDetailOnly();
144
145    /**
146     * Returns <code>true</code> if this container is being currently used to display a detail view.<p>
147     *
148     * @return <code>true</code> if this container is used to display a detail view
149     */
150    boolean isDetailView();
151
152    /**
153     * Returns if the container is editable by the current user.<p>
154     *
155     * @return <code>true</code> if the container is editable by the current user
156     */
157    boolean isEditable();
158
159    /**
160     * This is called when the elements of this container/group have been processed into CmsContainerPageElementPanels.<p>
161     *
162     * @param children the processed children
163     */
164    void onConsumeChildren(List<CmsContainerPageElementPanel> children);
165
166    /**
167     * Refreshes position and dimension of the highlighting border. Call when anything changed during the drag process.<p>
168     */
169    void refreshHighlighting();
170
171    /**
172     * Refreshes position and dimension of the highlighting border. Call when anything changed during the drag process.<p>
173     *
174     * @param positionInfo the position info to use
175     */
176    void refreshHighlighting(CmsPositionBean positionInfo);
177
178    /**
179     * Removes the highlighting border.<p>
180     */
181    void removeHighlighting();
182
183    /**
184     * Sets the placeholder visibility.<p>
185     *
186     * @param visible <code>true</code> to set the place holder visible
187     */
188    void setPlaceholderVisibility(boolean visible);
189
190    /**
191     * Shows list collector direct edit buttons (old direct edit style), if present.<p>
192     */
193    void showEditableListButtons();
194
195    /**
196     * Updates the cached position info.<p>
197     */
198    void updatePositionInfo();
199
200}