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.actor.gui.PtolemyFrame;
032import ptolemy.vergil.basic.ExportParameters;
033
034///////////////////////////////////////////////////////////////////
035//// WebExporter
036/**
037 * Interface for an object that provides a web exporting service
038 * for a Ptolemy II model.
039 *
040 * @author Edward A. Lee, Elizabeth Latronico
041 * @version $Id$
042 * @since Ptolemy II 10.0
043 * @Pt.ProposedRating Red (cxh)
044 * @Pt.AcceptedRating Red (cxh)
045 */
046public interface WebExporter {
047
048    ///////////////////////////////////////////////////////////////////
049    ////                         public methods                    ////
050
051    /** Add the given web content as a new attribute.
052     *  If <i>onceOnly</i> is true, then if identical content has
053     *  already been added, then it is not added again.
054     *  @param webAttribute The WebAttribute containing the content to add.
055     *  @param overwrite If true, overwrite any previously defined value for
056     *   the specified attribute. If false, then do nothing if there is already
057     *   an attribute with the specified name.
058     *  @return True if the specified attribute and value was defined (i.e.,
059     *   if there was a previous value, it was overwritten).
060     */
061    public boolean defineAttribute(WebAttribute webAttribute,
062            boolean overwrite);
063
064    /** Add the given web content as a new element to the specified position.
065     *  The position is expected to be one of "head", "start", or "end",
066     *  where anything else is interpreted as equivalent to "end".
067     *  If <i>onceOnly</i> is true, then if identical content has
068     *  already been added to the specified position, then it is not
069     *  added again.
070     *  @param webElement The WebElement containing the content to add and the
071     *  position.
072     *  @param onceOnly True to prevent duplicate content.
073     */
074    public void defineElement(WebElement webElement, boolean onceOnly);
075
076    /** During invocation an export, return
077     *  the parameters of the export. If not currently doing an export, return null.
078     *  @return The directory being written to.
079     */
080    public ExportParameters getExportParameters();
081
082    /** The frame (window) being exported.
083     *  @return The frame being exported.
084     */
085    public PtolemyFrame getFrame();
086
087    /** Set the title to be used for the page being exported.
088     *  @param title The title.
089     *  @param showInHTML True to produce an HTML title prior to the model image.
090     */
091    public void setTitle(String title, boolean showInHTML);
092}