KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > explorer > CmsExplorerInit


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/explorer/CmsExplorerInit.java,v $
3  * Date : $Date: 2006/05/08 08:15:03 $
4  * Version: $Revision: 1.3 $
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.explorer;
33
34 import org.opencms.db.CmsUserSettings;
35 import org.opencms.file.types.I_CmsResourceType;
36 import org.opencms.jsp.CmsJspActionElement;
37 import org.opencms.main.OpenCms;
38 import org.opencms.workplace.CmsWorkplace;
39 import org.opencms.workplace.CmsWorkplaceSettings;
40
41 import java.util.List JavaDoc;
42
43 import javax.servlet.http.HttpServletRequest JavaDoc;
44
45 /**
46  * Provides methods for building the top frame Javascript code for the Explorer view of the OpenCms Workplace.<p>
47  *
48  * The following files use this class:
49  * <ul>
50  * <li>/views/top_js.jsp
51  * </ul>
52  * <p>
53  *
54  * @author Andreas Zahner
55  *
56  * @version $Revision: 1.3 $
57  *
58  * @since 6.2.0
59  */

60 public class CmsExplorerInit extends CmsWorkplace {
61
62     /**
63      * Public constructor.<p>
64      *
65      * @param jsp an initialized JSP action element
66      */

67     public CmsExplorerInit(CmsJspActionElement jsp) {
68
69         super(jsp);
70     }
71     
72     /**
73      * Builds the Javascript for the Workplace context menus.<p>
74      *
75      * @return the Javascript for the Workplace context menus
76      */

77     public String JavaDoc buildContextMenues() {
78
79         StringBuffer JavaDoc result = new StringBuffer JavaDoc();
80         // get all available resource types
81
List JavaDoc allResTypes = OpenCms.getResourceManager().getResourceTypes();
82         for (int i = 0; i < allResTypes.size(); i++) {
83             // loop through all types
84
I_CmsResourceType type = (I_CmsResourceType)allResTypes.get(i);
85             int resTypeId = type.getTypeId();
86             // get explorer type settings for current resource type
87
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName());
88             if (settings != null) {
89                 // append the context menu of the current resource type
90
result.append(settings.getContextMenu().getJSEntries(
91                     getCms(),
92                     settings,
93                     resTypeId,
94                     getMessages()));
95             }
96         }
97         
98         result.append("\n");
99         // add generic multi context menu to JS
100
result.append(OpenCms.getWorkplaceManager().getMultiContextMenu().getJSEntries(getCms(), null, -1, getMessages()));
101
102         return result.toString();
103     }
104     
105     /**
106      * Returns the file settings for the Workplace explorer view.<p>
107      *
108      * @return the file settings for the Workplace explorer view
109      */

110     public int getExplorerSettings() {
111
112         CmsUserSettings settings = new CmsUserSettings(getCms());
113         int value = settings.getExplorerSettings();
114         return value;
115     }
116
117     /**
118      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
119      */

120     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
121
122         // nothing to do for JS creation
123
}
124 }
Popular Tags