001/* Interface for parameters that provide web export content.
002
003 Copyright (c) 2011-2013 The Regents of the University of California.
004 All rights reserved.
005 Permission is hereby granted, without written agreement and without
006 license or royalty fees, to use, copy, modify, and distribute this
007 software and its documentation for any purpose, provided that the above
008 copyright notice and the following two paragraphs appear in all copies
009 of this software.
010
011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015 SUCH DAMAGE.
016
017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022 ENHANCEMENTS, OR MODIFICATIONS.
023
024 PT_COPYRIGHT_VERSION_2
025 COPYRIGHTENDKEY
026
027 */
028
029package ptolemy.vergil.basic.export.web;
030
031import ptolemy.kernel.util.IllegalActionException;
032import ptolemy.kernel.util.Nameable;
033
034///////////////////////////////////////////////////////////////////
035//// WebExportable
036/**
037 * Interface for parameters that provide web export content.
038 *
039 * @author Edward A. Lee, Elizabeth Latronico
040 * @version $Id$
041 * @since Ptolemy II 10.0
042 * @Pt.ProposedRating Red (cxh)
043 * @Pt.AcceptedRating Red (cxh)
044 */
045public interface WebExportable extends Nameable {
046
047    ///////////////////////////////////////////////////////////////////
048    ////                         public methods                    ////
049
050    /** Return the Mime type of the content (for example, text/html).
051     * The Mime type is used by browsers to determine how to render the content.
052     * The Mime type is set using HttpResponse's setContentType() method.
053     * Please see the list of Mime types here, in the Media type and subtype(s)
054     * field of the table:
055     * http://reference.sitepoint.com/html/mime-types-full
056     *
057     * @return The Mime type of the content (for example, text/html)
058     */
059    public String getMimeType();
060
061    /** Returns true if the content in the WebExporter for this object should
062     *  be overwritten; false if the original content should be kept.
063     *  Note that all objects from the WebExportable are treated in a uniform
064     *  manner.  For example, it's not possible to overwrite some objects'
065     *  values but keep other objects' values from the same WebExportable.
066     *
067     * @return True if the content in the WebExporter for this object should
068     *  be overwritten; false if the original content should be kept
069     */
070    public boolean isOverwriteable();
071
072    /** Provide content to the specified web exporter.
073     *  This may include, for example, HTML pages and fragments, Javascript
074     *  function definitions and calls, CSS styling, and more. Throw an
075     *  IllegalActionException if something is wrong with the web content.
076     *
077     *  @param exporter The web exporter to be used
078     *  @exception IllegalActionException If something is wrong with the web
079     *  content.
080     */
081    public void provideContent(WebExporter exporter)
082            throws IllegalActionException;
083}