KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsImageComparisonDialog.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.jsp.CmsJspActionElement;
32 import org.opencms.workplace.CmsDialog;
33 import org.opencms.workplace.commons.CmsHistoryList;
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 CmsImageComparisonDialog 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 CmsImageComparisonDialog(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         String JavaDoc link1 = "";
87         String JavaDoc link2 = "";
88         if ("-1".equals(m_paramTagId1)) {
89             // offline version
90
link1 = getParamResource();
91         } else {
92             link1 = CmsHistoryList.getBackupLink(m_paramPath1, m_paramTagId1);
93         }
94         if ("-1".equals(m_paramTagId2)) {
95             // offline version
96
link2 = getParamResource();
97         } else {
98             link2 = CmsHistoryList.getBackupLink(m_paramPath2, m_paramTagId2);
99         }
100         JspWriter JavaDoc out = getJsp().getJspContext().getOut();
101         out.println(dialogBlockStart(key(Messages.GUI_COMPARE_CONTENT_0)));
102         out.println(dialogContentStart(null));
103         out.println("<table cellpadding='0' cellspacing='0' border='0' class='maxwidth'><tr align='center'><th>");
104         out.println(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion1}));
105         out.println("</th><th>");
106         out.println(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion2}));
107         out.println("</th></tr>");
108         out.println("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>");
109         out.println("\t<tr align='center'>\n");
110         out.println("\t\t<td width='50%'><img SRC='");
111         out.print(getJsp().link(link1));
112         out.print("' alt='");
113         out.print(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion1}));
114         out.print("'/></td>\n");
115         out.println("\t\t<td width='50%'><img SRC='");
116         out.print(getJsp().link(link2));
117         out.print("' alt='");
118         out.print(key(Messages.GUI_COMPARE_VERSION_1, new String JavaDoc[] {m_paramVersion2}));
119         out.print("'/></td>\n");
120         out.println("\t</tr>");
121         out.println("</table>");
122         out.println(dialogBlockEnd());
123         out.println(dialogContentEnd());
124         out.println(dialogEnd());
125         out.println(bodyEnd());
126         out.println(htmlEnd());
127     }
128
129     /**
130      * Returns the paramPath1.<p>
131      *
132      * @return the paramPath1
133      */

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

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

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

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

174     public String JavaDoc getParamVersion1() {
175
176         return m_paramVersion1;
177     }
178
179     /**
180      * Returns the paramVersion2.<p>
181      *
182      * @return the paramVersion2
183      */

184     public String JavaDoc getParamVersion2() {
185
186         return m_paramVersion2;
187     }
188
189     /**
190      * Sets the paramPath1.<p>
191      *
192      * @param paramPath1 the paramPath1 to set
193      */

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

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

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

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

234     public void setParamVersion1(String JavaDoc paramVersion1) {
235
236         m_paramVersion1 = paramVersion1;
237     }
238
239     /**
240      * Sets the paramVersion2.<p>
241      *
242      * @param paramVersion2 the paramVersion2 to set
243      */

244     public void setParamVersion2(String JavaDoc paramVersion2) {
245
246         m_paramVersion2 = paramVersion2;
247     }
248 }
Popular Tags