01: /*
02: * This file is part of PFIXCORE.
03: *
04: * PFIXCORE is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU Lesser General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * PFIXCORE is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with PFIXCORE; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: */
19:
20: package de.schlund.pfixcore.util.basicapp.projectdom;
21:
22: import org.w3c.dom.Document;
23:
24: import de.schlund.pfixcore.util.basicapp.helper.AppValues;
25: import de.schlund.pfixcore.util.basicapp.helper.XmlUtils;
26: import de.schlund.pfixcore.util.basicapp.objects.Project;
27:
28: /**
29: * This class will deliver a new Dom of the frame.xml with all necessary
30: * changes for a new project
31: *
32: * @author <a href="mailto:rapude@schlund.de">Ralf Rapude</a>
33: * @version $Id: FrameXmlDom.java 3302 2007-11-30 16:56:16Z jenstl $
34: */
35: public final class FrameXmlDom {
36: /** The current dom */
37: private Document domDoc = null;
38: /** A String Buffer to get e.g. correctPaths */
39: private StringBuffer buffy = new StringBuffer();
40: /** The current Project */
41: Project project = null;
42: private String projectName = null;
43:
44: /**
45: * Constructor initializes the Project Object
46: * and the dom for the current document
47: * @param project The current project
48: * @param domDoc the current Dom given by HandleXmlFiles
49: */
50: public FrameXmlDom(Project project, Document domDoc) {
51: this .domDoc = domDoc;
52: projectName = project.getProjectName();
53:
54: prepareFrameXml();
55: }
56:
57: /**
58: * HandleXmlFiles has given a dom to this class.
59: * This method will change all necessary attributes.
60: */
61: private void prepareFrameXml() {
62: buffy.append(projectName);
63: buffy.append(AppValues.PATHTO_PAGES);
64: buffy.append(AppValues.CONTENTXML);
65:
66: domDoc = XmlUtils.changeAttributes(domDoc,
67: AppValues.FRAMETAG_INCLUDE, AppValues.FRAMEATT_HREF,
68: buffy.toString(), false);
69: }
70:
71: /**
72: * Gives the current dom back to
73: * HandleXmlFiles
74: * @return Document The current dom
75: */
76: public Document getDom() {
77: return domDoc;
78: }
79: }
|