KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > comparison > CmsPointerComparisonDialog


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsPointerComparisonDialog.java,v $
3  * Date : $Date: 2006/03/30 07:50:17 $
4  * Version: $Revision: 1.3 $
5  *
6  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
7  * All rights reserved.
8  *
9  * This source code is the intellectual property of Alkacon Software GmbH.
10  * It is PROPRIETARY and CONFIDENTIAL.
11  * Use of this source code is subject to license terms.
12  *
13  * In order to use this source code, you need written permission from
14  * Alkacon Software GmbH. Redistribution of this source code, in modified
15  * or unmodified form, is not allowed unless written permission by
16  * Alkacon Software GmbH has been given.
17  *
18  * ALKACON SOFTWARE GMBH MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
19  * OF THIS SOURCE CODE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
20  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21  * PURPOSE, OR NON-INFRINGEMENT. ALKACON SOFTWARE GMBH SHALL NOT BE LIABLE FOR ANY
22  * DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
23  * THIS SOURCE CODE OR ITS DERIVATIVES.
24  *
25  * For further information about Alkacon Software GmbH, please see the
26  * company website: http://www.alkacon.com
27  */

28
29 package org.opencms.workplace.comparison;
30
31 import org.opencms.file.CmsFile;
32 import org.opencms.jsp.CmsJspActionElement;
33 import org.opencms.workplace.CmsDialog;
34
35 import javax.servlet.jsp.JspWriter JavaDoc;
36
37 /**
38  * Provides a GUI for displaying two images.<p>
39  *
40  * @author Jan Baudisch
41  *
42  * @version $Revision: 1.3 $
43  *
44  * @since 6.0.0
45  */

46 public class CmsPointerComparisonDialog extends CmsDialog {
47
48     /** Parameter value for the path of the first file. */
49     private String JavaDoc m_paramPath1;
50
51     /** Parameter value for the path of the second file. */
52     private String JavaDoc m_paramPath2;
53
54     /** Parameter value for the tag id of the first file. */
55     private String JavaDoc m_paramTagId1;
56
57     /** Parameter value for the tag id of the second file. */
58     private String JavaDoc m_paramTagId2;
59
60     /** Parameter value for the version of the first file. */
61     private String JavaDoc m_paramVersion1;
62
63     /** Parameter value for the version of the second file. */
64     private String JavaDoc m_paramVersion2;
65
66     /**
67      * Default constructor.<p>
68      *
69      * @param jsp an initialized JSP action element
70      */

71     public CmsPointerComparisonDialog(CmsJspActionElement jsp) {
72
73         super(jsp);
74     }
75
76     /**
77      * Performs the dialog actions depending on the initialized action and displays the dialog form.<p>
78      *
79      * @throws Exception if writing to the JSP out fails
80      */

81     public void displayDialog() throws Exception JavaDoc {
82
83         if (getAction() == ACTION_CANCEL) {
84             actionCloseDialog();
85         }
86         CmsFile resource1 = CmsResourceComparisonDialog.readFile(getCms(), getParamPath1(),
87             getParamVersion1(), Integer.parseInt(getParamTagId1()));
88         CmsFile resource2 = CmsResourceComparisonDialog.readFile(getCms(), getParamPath2(),
89             getParamVersion2(), Integer.parseInt(getParamTagId2()));
90         String JavaDoc linkTarget1 = new String JavaDoc(resource1.getContents());
91         String JavaDoc linkTarget2 = new String JavaDoc(resource2.getContents());
92         JspWriter JavaDoc out = getJsp().getJspContext().getOut();
93         out.println(dialogBlockStart(key(Messages.GUI_COMPARE_CONTENT_0)));
94         out.println(dialogContentStart(null));
95         out.println("<table cellpadding='0' cellspacing='0' border='0' class='maxwidth'><tr align='center'><th>");
96         out.println(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion1}));
97         out.println("</th><th>");
98         out.println(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion2}));
99         out.println("</th></tr>");
100         out.print("<tr><td><a HREF=\"");
101         out.print(linkTarget1);
102         out.print("\">");
103         out.print(linkTarget1);
104         out.print("</a>");
105         out.print("</td><td width='50%'>\n");
106         out.print("<a HREF=\"");
107         out.print(linkTarget2);
108         out.print("\">");
109         out.print(linkTarget2);
110         out.print("</a>");
111         out.println("</td></td></table>");
112         out.println(dialogBlockEnd());
113         out.println(dialogContentEnd());
114         out.println(dialogEnd());
115         out.println(bodyEnd());
116         out.println(htmlEnd());
117     }
118
119     /**
120      * Returns the paramPath1.<p>
121      *
122      * @return the paramPath1
123      */

124     public String JavaDoc getParamPath1() {
125
126         return m_paramPath1;
127     }
128
129     /**
130      * Returns the paramPath2.<p>
131      *
132      * @return the paramPath2
133      */

134     public String JavaDoc getParamPath2() {
135
136         return m_paramPath2;
137     }
138
139     /**
140      * Returns the paramTagId1.<p>
141      *
142      * @return the paramTagId1
143      */

144     public String JavaDoc getParamTagId1() {
145
146         return m_paramTagId1;
147     }
148
149     /**
150      * Returns the paramTagId2.<p>
151      *
152      * @return the paramTagId2
153      */

154     public String JavaDoc getParamTagId2() {
155
156         return m_paramTagId2;
157     }
158
159     /**
160      * Returns the paramVersion1.<p>
161      *
162      * @return the paramVersion1
163      */

164     public String JavaDoc getParamVersion1() {
165
166         return m_paramVersion1;
167     }
168
169     /**
170      * Returns the paramVersion2.<p>
171      *
172      * @return the paramVersion2
173      */

174     public String JavaDoc getParamVersion2() {
175
176         return m_paramVersion2;
177     }
178
179     /**
180      * Sets the paramPath1.<p>
181      *
182      * @param paramPath1 the paramPath1 to set
183      */

184     public void setParamPath1(String JavaDoc paramPath1) {
185
186         m_paramPath1 = paramPath1;
187     }
188
189     /**
190      * Sets the paramPath2.<p>
191      *
192      * @param paramPath2 the paramPath2 to set
193      */

194     public void setParamPath2(String JavaDoc paramPath2) {
195
196         m_paramPath2 = paramPath2;
197     }
198
199     /**
200      * Sets the paramTagId1.<p>
201      *
202      * @param paramTagId1 the paramTagId1 to set
203      */

204     public void setParamTagId1(String JavaDoc paramTagId1) {
205
206         m_paramTagId1 = paramTagId1;
207     }
208
209     /**
210      * Sets the paramTagId2.<p>
211      *
212      * @param paramTagId2 the paramTagId2 to set
213      */

214     public void setParamTagId2(String JavaDoc paramTagId2) {
215
216         m_paramTagId2 = paramTagId2;
217     }
218
219     /**
220      * Sets the paramVersion1.<p>
221      *
222      * @param paramVersion1 the paramVersion1 to set
223      */

224     public void setParamVersion1(String JavaDoc paramVersion1) {
225
226         m_paramVersion1 = paramVersion1;
227     }
228
229     /**
230      * Sets the paramVersion2.<p>
231      *
232      * @param paramVersion2 the paramVersion2 to set
233      */

234     public void setParamVersion2(String JavaDoc paramVersion2) {
235
236         m_paramVersion2 = paramVersion2;
237     }
238 }
Popular Tags