001: /*
002: * This file is part of PFIXCORE.
003: *
004: * PFIXCORE is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU Lesser General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * PFIXCORE is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public License
015: * along with PFIXCORE; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package de.schlund.pfixcore.editor2.core.dom;
020:
021: import java.util.Collection;
022:
023: import org.w3c.dom.Node;
024:
025: import de.schlund.pfixcore.editor2.core.exception.EditorIOException;
026: import de.schlund.pfixcore.editor2.core.exception.EditorParsingException;
027: import de.schlund.pfixcore.editor2.core.exception.EditorSecurityException;
028:
029: /**
030: * Represents an include part which can be regarded as a "piece of XML" that can
031: * be included in other documents.
032: *
033: * @author Sebastian Marsching <sebastian.marsching@1und1.de>
034: */
035: public interface IncludePart extends Comparable<IncludePart> {
036: /**
037: * Returns the name of this IncludePart. The name is used to distinctly
038: * identify an IncludePart within an IncludeFile.
039: *
040: * @return Unique name identifying this IncludePart
041: */
042: String getName();
043:
044: /**
045: * Returns the IncludeFile this IncludePart is part of.
046: *
047: * @return IncludeFile corresponding to this IncludePart
048: */
049: IncludeFile getIncludeFile();
050:
051: /**
052: * Returns a XML Node representing the whole include part
053: *
054: * @return XML for this IncludePart including all themes
055: */
056: Node getContentXML();
057:
058: /**
059: * Returns variant of this IncludePart for a specific theme
060: *
061: * @param theme
062: * Theme to return the variant for or <code>null</code> for the
063: * "default" theme
064: * @return Variant of this IncludePart for theme or <code>null</code> if
065: * no variant for the theme can be found
066: */
067: IncludePartThemeVariant getThemeVariant(Theme theme);
068:
069: /**
070: * Creates a new theme variant for this IncludePart. If there is already a
071: * variant for the specified theme, the existing variant is returned.
072: *
073: * @param theme
074: * Theme to create a variant for.
075: * @return New IncludePartThemeVariant object for the specified theme
076: * @throws EditorSecurityException
077: * @throws EditorParsingException
078: * @throws EditorIOException
079: */
080: IncludePartThemeVariant createThemeVariant(Theme theme)
081: throws EditorIOException, EditorParsingException,
082: EditorSecurityException;
083:
084: /**
085: * Return true, if there is a variant for the specified theme. A variant is
086: * not considered to "exist" until it has been filled with content.
087: *
088: * @param theme
089: * Theme to find a variant for
090: * @return <code>true</code> if theme variant is existing,
091: * <code>false</code> otherwise
092: */
093: boolean hasThemeVariant(Theme theme);
094:
095: /**
096: * Deletes an IncludePartThemeVariant (only possible for non "default"
097: * variants).
098: *
099: * @param variant
100: * Variant to delete
101: * @throws EditorSecurityException
102: * If deletion of this variant is not allowed.
103: * @throws EditorIOException
104: * If I/O operations on inlude file failed
105: * @throws EditorParsingException
106: * If parsing of include file failed
107: */
108: void deleteThemeVariant(IncludePartThemeVariant variant)
109: throws EditorSecurityException, EditorIOException,
110: EditorParsingException;
111:
112: /**
113: * Returns a list of all theme variants, which are existing for this
114: * IncludePart
115: *
116: * @return All theme variants for this IncludePart
117: * @see IncludePartThemeVariant
118: */
119: Collection<IncludePartThemeVariant> getThemeVariants();
120:
121: /**
122: * Returns a list of all themes, which could be possibly used for this
123: * IncludePart. This does not necessarily mean, that there is also an
124: * existing variant for each theme returned.
125: *
126: * @return List of possible themes
127: * @see Theme
128: */
129: Collection<Theme> getPossibleThemes();
130: }
|