KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > list > CmsListPrintIAction


1 /*
2  * File : $Source$
3  * Date : $Date$
4  * Version: $Revision$
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.list;
33
34 import org.opencms.i18n.CmsEncoder;
35 import org.opencms.workplace.CmsWorkplace;
36
37 /**
38  * Generates a print preview for a list.<p>
39  *
40  * @author Michael Moossen
41  *
42  * @version $Revision$
43  *
44  * @since 6.0.0
45  */

46 public class CmsListPrintIAction extends A_CmsListIndependentJsAction {
47
48     /** List independent action id constant. */
49     public static final String JavaDoc LIST_ACTION_ID = "iap";
50
51     /**
52      * Default constructor.<p>
53      */

54     public CmsListPrintIAction() {
55
56         super(LIST_ACTION_ID);
57         setName(Messages.get().container(Messages.GUI_LIST_ACTION_PRINT_NAME_0));
58         setHelpText(Messages.get().container(Messages.GUI_LIST_ACTION_PRINT_HELP_0));
59         setConfirmationMessage(Messages.get().container(Messages.GUI_LIST_ACTION_PRINT_CONF_0));
60         setIconPath("list/print.png");
61         setEnabled(true);
62         setVisible(true);
63     }
64
65     /**
66      * @see org.opencms.workplace.list.A_CmsListIndependentJsAction#jsCode(CmsWorkplace)
67      */

68     public String JavaDoc jsCode(CmsWorkplace wp) {
69
70         String JavaDoc url = wp.getJsp().link(
71             "/system/workplace/commons/list-print.jsp?"
72                 + CmsListPrintDialog.PARAM_LISTCLASS
73                 + "="
74                 + CmsEncoder.encode(wp.getClass().getName()));
75         String JavaDoc opts = "toolbar=no,location=no,directories=no,status=yes,menubar=0,scrollbars=yes,resizable=yes,top=50,left=50,width=700,height=500";
76         StringBuffer JavaDoc js = new StringBuffer JavaDoc(512);
77         js.append("javascript:window.open('");
78         js.append(url);
79         js.append("', 'opencmsprintlist', '");
80         js.append(opts);
81         js.append("');");
82         return js.toString();
83     }
84 }
85
Popular Tags