001/*
002 * Copyright (c) 2000 World Wide Web Consortium,
003 * (Massachusetts Institute of Technology, Institut National de
004 * Recherche en Informatique et en Automatique, Keio University). All
005 * Rights Reserved. This program is distributed under the W3C's Software
006 * Intellectual Property License. This program is distributed in the
007 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009 * PURPOSE.
010 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011 */
012
013package org.w3c.dom.stylesheets;
014
015import org.w3c.dom.DOMException;
016
017/**
018 *  The <code>MediaList</code> interface provides the abstraction of an 
019 * ordered collection of media, without defining or constraining how this 
020 * collection is implemented. An empty list is the same as a list that 
021 * contains the medium <code>"all"</code>. 
022 * <p> The items in the <code>MediaList</code> are accessible via an integral 
023 * index, starting from 0. 
024 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
025 * @since DOM Level 2
026 */
027public interface MediaList {
028    /**
029     *  The parsable textual representation of the media list. This is a 
030     * comma-separated list of media. 
031     */
032    public String getMediaText();
033    /**
034     *  The parsable textual representation of the media list. This is a 
035     * comma-separated list of media. 
036     * @exception DOMException
037     *   SYNTAX_ERR: Raised if the specified string value has a syntax error 
038     *   and is unparsable.
039     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is 
040     *   readonly.
041     */
042    public void setMediaText(String mediaText)
043                             throws DOMException;
044
045    /**
046     *  The number of media in the list. The range of valid media is 
047     * <code>0</code> to <code>length-1</code> inclusive. 
048     */
049    public int getLength();
050
051    /**
052     *  Returns the <code>index</code>th in the list. If <code>index</code> is 
053     * greater than or equal to the number of media in the list, this 
054     * returns <code>null</code>. 
055     * @param index  Index into the collection. 
056     * @return  The medium at the <code>index</code>th position in the 
057     *   <code>MediaList</code>, or <code>null</code> if that is not a valid 
058     *   index. 
059     */
060    public String item(int index);
061
062    /**
063     *  Deletes the medium indicated by <code>oldMedium</code> from the list. 
064     * @param oldMedium The medium to delete in the media list.
065     * @exception DOMException
066     *    NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly. 
067     *   <br> NOT_FOUND_ERR: Raised if <code>oldMedium</code> is not in the 
068     *   list. 
069     */
070    public void deleteMedium(String oldMedium)
071                             throws DOMException;
072
073    /**
074     *  Adds the medium <code>newMedium</code> to the end of the list. If the 
075     * <code>newMedium</code> is already used, it is first removed. 
076     * @param newMedium The new medium to add.
077     * @exception DOMException
078     *    INVALID_CHARACTER_ERR: If the medium contains characters that are 
079     *   invalid in the underlying style language. 
080     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly. 
081     */
082    public void appendMedium(String newMedium)
083                             throws DOMException;
084
085}