001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/comparison/CmsImageComparisonDialog.java,v $
003: * Date : $Date: 2008-02-27 12:05:55 $
004: * Version: $Revision: 1.6 $
005: *
006: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
007: * All rights reserved.
008: *
009: * This source code is the intellectual property of Alkacon Software GmbH.
010: * It is PROPRIETARY and CONFIDENTIAL.
011: * Use of this source code is subject to license terms.
012: *
013: * In order to use this source code, you need written permission from
014: * Alkacon Software GmbH. Redistribution of this source code, in modified
015: * or unmodified form, is not allowed unless written permission by
016: * Alkacon Software GmbH has been given.
017: *
018: * ALKACON SOFTWARE GMBH MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
019: * OF THIS SOURCE CODE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020: * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
021: * PURPOSE, OR NON-INFRINGEMENT. ALKACON SOFTWARE GMBH SHALL NOT BE LIABLE FOR ANY
022: * DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
023: * THIS SOURCE CODE OR ITS DERIVATIVES.
024: *
025: * For further information about Alkacon Software GmbH, please see the
026: * company website: http://www.alkacon.com
027: */
028:
029: package org.opencms.workplace.comparison;
030:
031: import org.opencms.jsp.CmsJspActionElement;
032: import org.opencms.util.CmsUUID;
033: import org.opencms.workplace.CmsDialog;
034: import org.opencms.workplace.commons.CmsHistoryList;
035:
036: import javax.servlet.jsp.JspWriter;
037:
038: /**
039: * Provides a GUI for displaying two images.<p>
040: *
041: * @author Jan Baudisch
042: *
043: * @version $Revision: 1.6 $
044: *
045: * @since 6.0.0
046: */
047: public class CmsImageComparisonDialog extends CmsDialog {
048:
049: /** Parameter value for the structure id of the first file. */
050: private String m_paramId1;
051:
052: /** Parameter value for the structure id of the second file. */
053: private String m_paramId2;
054:
055: /** Parameter value for the version of the first file. */
056: private String m_paramVersion1;
057:
058: /** Parameter value for the version of the second file. */
059: private String m_paramVersion2;
060:
061: /**
062: * Default constructor.<p>
063: *
064: * @param jsp an initialized JSP action element
065: */
066: public CmsImageComparisonDialog(CmsJspActionElement jsp) {
067:
068: super (jsp);
069: }
070:
071: /**
072: * Performs the dialog actions depending on the initialized action and displays the dialog form.<p>
073: *
074: * @throws Exception if writing to the JSP out fails
075: */
076: public void displayDialog() throws Exception {
077:
078: if (getAction() == ACTION_CANCEL) {
079: actionCloseDialog();
080: }
081: String link1 = CmsHistoryList.getHistoryLink(getCms(),
082: new CmsUUID(m_paramId1), m_paramVersion1);
083: String link2 = CmsHistoryList.getHistoryLink(getCms(),
084: new CmsUUID(m_paramId2), m_paramVersion2);
085: JspWriter out = getJsp().getJspContext().getOut();
086: out
087: .println(dialogBlockStart(key(Messages.GUI_COMPARE_CONTENT_0)));
088: out.println(dialogContentStart(null));
089: out
090: .println("<table cellpadding='0' cellspacing='0' border='0' class='maxwidth'><tr align='center'><th>");
091: out.println(key(Messages.GUI_COMPARE_VERSION_1,
092: new String[] { CmsHistoryList.getDisplayVersion(
093: m_paramVersion1, getLocale()) }));
094: out.println("</th><th>");
095: out.println(key(Messages.GUI_COMPARE_VERSION_1,
096: new String[] { CmsHistoryList.getDisplayVersion(
097: m_paramVersion2, getLocale()) }));
098: out.println("</th></tr>");
099: out.println("<tr><td> </td><td> </td></tr>");
100: out.println("\t<tr align='center'>\n");
101: out.println("\t\t<td width='50%'><img src='");
102: out.print(getJsp().link(link1));
103: out.print("' alt='");
104: out.print(key(Messages.GUI_COMPARE_VERSION_1,
105: new String[] { CmsHistoryList.getDisplayVersion(
106: m_paramVersion1, getLocale()) }));
107: out.print("'/></td>\n");
108: out.println("\t\t<td width='50%'><img src='");
109: out.print(getJsp().link(link2));
110: out.print("' alt='");
111: out.print(key(Messages.GUI_COMPARE_VERSION_1,
112: new String[] { CmsHistoryList.getDisplayVersion(
113: m_paramVersion2, getLocale()) }));
114: out.print("'/></td>\n");
115: out.println("\t</tr>");
116: out.println("</table>");
117: out.println(dialogBlockEnd());
118: out.println(dialogContentEnd());
119: out.println(dialogEnd());
120: out.println(bodyEnd());
121: out.println(htmlEnd());
122: }
123:
124: /**
125: * Returns the paramId1.<p>
126: *
127: * @return the paramId1
128: */
129: public String getParamId1() {
130:
131: return m_paramId1;
132: }
133:
134: /**
135: * Returns the paramId2.<p>
136: *
137: * @return the paramId2
138: */
139: public String getParamId2() {
140:
141: return m_paramId2;
142: }
143:
144: /**
145: * Returns the paramVersion1.<p>
146: *
147: * @return the paramVersion1
148: */
149: public String getParamVersion1() {
150:
151: return m_paramVersion1;
152: }
153:
154: /**
155: * Returns the paramVersion2.<p>
156: *
157: * @return the paramVersion2
158: */
159: public String getParamVersion2() {
160:
161: return m_paramVersion2;
162: }
163:
164: /**
165: * Sets the paramId1.<p>
166: *
167: * @param paramId1 the paramId1 to set
168: */
169: public void setParamId1(String paramId1) {
170:
171: m_paramId1 = paramId1;
172: }
173:
174: /**
175: * Sets the paramId2.<p>
176: *
177: * @param paramId2 the paramId2 to set
178: */
179: public void setParamId2(String paramId2) {
180:
181: m_paramId2 = paramId2;
182: }
183:
184: /**
185: * Sets the paramVersion1.<p>
186: *
187: * @param paramVersion1 the paramVersion1 to set
188: */
189: public void setParamVersion1(String paramVersion1) {
190:
191: m_paramVersion1 = paramVersion1;
192: }
193:
194: /**
195: * Sets the paramVersion2.<p>
196: *
197: * @param paramVersion2 the paramVersion2 to set
198: */
199: public void setParamVersion2(String paramVersion2) {
200:
201: m_paramVersion2 = paramVersion2;
202: }
203: }
|