1. /*
  2. * Copyright (c) 2000 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE.
  10. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11. */
  12. package org.w3c.dom.stylesheets;
  13. import org.w3c.dom.DOMException;
  14. /**
  15. * The <code>MediaList</code> interface provides the abstraction of an
  16. * ordered collection of media, without defining or constraining how this
  17. * collection is implemented. An empty list is the same as a list that
  18. * contains the medium <code>"all"</code>.
  19. * <p> The items in the <code>MediaList</code> are accessible via an integral
  20. * index, starting from 0.
  21. * <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>.
  22. * @since DOM Level 2
  23. */
  24. public interface MediaList {
  25. /**
  26. * The parsable textual representation of the media list. This is a
  27. * comma-separated list of media.
  28. * @exception DOMException
  29. * SYNTAX_ERR: Raised if the specified string value has a syntax error
  30. * and is unparsable.
  31. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is
  32. * readonly.
  33. */
  34. public String getMediaText();
  35. public void setMediaText(String mediaText)
  36. throws DOMException;
  37. /**
  38. * The number of media in the list. The range of valid media is
  39. * <code>0</code> to <code>length-1</code> inclusive.
  40. */
  41. public int getLength();
  42. /**
  43. * Returns the <code>index</code>th in the list. If <code>index</code> is
  44. * greater than or equal to the number of media in the list, this
  45. * returns <code>null</code>.
  46. * @param index Index into the collection.
  47. * @return The medium at the <code>index</code>th position in the
  48. * <code>MediaList</code>, or <code>null</code> if that is not a valid
  49. * index.
  50. */
  51. public String item(int index);
  52. /**
  53. * Deletes the medium indicated by <code>oldMedium</code> from the list.
  54. * @param oldMediumThe medium to delete in the media list.
  55. * @exception DOMException
  56. * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
  57. * <br> NOT_FOUND_ERR: Raised if <code>oldMedium</code> is not in the
  58. * list.
  59. */
  60. public void deleteMedium(String oldMedium)
  61. throws DOMException;
  62. /**
  63. * Adds the medium <code>newMedium</code> to the end of the list. If the
  64. * <code>newMedium</code> is already used, it is first removed.
  65. * @param newMediumThe new medium to add.
  66. * @exception DOMException
  67. * INVALID_CHARACTER_ERR: If the medium contains characters that are
  68. * invalid in the underlying style language.
  69. * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
  70. */
  71. public void appendMedium(String newMedium)
  72. throws DOMException;
  73. }