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.widgets;
029
030import org.opencms.file.CmsObject;
031import org.opencms.file.CmsResource;
032import org.opencms.i18n.CmsMessages;
033import org.opencms.xml.content.I_CmsXmlContentHandler.DisplayType;
034import org.opencms.xml.types.A_CmsXmlContentValue;
035
036import java.util.List;
037import java.util.Locale;
038
039/**
040 * Widgets to be used with the new XML content editor are required to implement this interface.<p>
041 */
042public interface I_CmsADEWidget extends I_CmsWidget {
043
044    /**
045     * Returns the configuration string for the ADE content editor widget.<p>
046     *
047     * @param cms the OpenCms context
048     * @param contentValue the schema type
049     * @param messages the messages
050     * @param resource the edited resource
051     * @param contentLocale the content locale
052     *
053     * @return the configuration string
054     */
055    String getConfiguration(
056        CmsObject cms,
057        A_CmsXmlContentValue contentValue,
058        CmsMessages messages,
059        CmsResource resource,
060        Locale contentLocale);
061
062    /**
063     * Returns a list of CSS resources required by the widget.<p>
064     *
065     * @param cms the current OpenCms context
066     *
067     * @return the required CSS resource links
068     */
069    List<String> getCssResourceLinks(CmsObject cms);
070
071    /**
072     * Returns the default display type of this widget.<p>
073     *
074     * @return the default display type
075     */
076    DisplayType getDefaultDisplayType();
077
078    /**
079     * Returns the java script initialization call.<p>
080     *
081     * @return the java script initialization call
082     */
083    String getInitCall();
084
085    /**
086     * Returns a list of java script resources required by the widget.<p>
087     *
088     * @param cms the current OpenCms context
089     *
090     * @return the required java script resource links
091     */
092    List<String> getJavaScriptResourceLinks(CmsObject cms);
093
094    /**
095     * Returns the class name of the widget.<p>
096     *
097     * @return the class name
098     */
099    String getWidgetName();
100
101    /**
102     * Returns if this is an internal widget.<p>
103     * Only widgets belonging to the OpenCms core should be marked as internal.<p>
104     *
105     * @return <code>true</code> if this is an internal widget
106     */
107    boolean isInternal();
108
109}