KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > bean > preview > SpacePreviewBean


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.web.bean.preview;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.HashMap JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.Map JavaDoc;
23
24 import javax.faces.context.FacesContext;
25 import javax.faces.event.ActionEvent;
26 import javax.faces.model.SelectItem;
27
28 import org.alfresco.model.ContentModel;
29 import org.alfresco.service.cmr.dictionary.DictionaryService;
30 import org.alfresco.service.cmr.repository.NodeRef;
31 import org.alfresco.service.cmr.repository.NodeService;
32 import org.alfresco.service.cmr.repository.TemplateImageResolver;
33 import org.alfresco.service.cmr.repository.TemplateNode;
34 import org.alfresco.service.cmr.search.SearchService;
35 import org.alfresco.service.namespace.NamespaceService;
36 import org.alfresco.service.namespace.QName;
37 import org.alfresco.web.app.Application;
38 import org.alfresco.web.bean.BrowseBean;
39 import org.alfresco.web.bean.NavigationBean;
40 import org.alfresco.web.bean.repository.Node;
41 import org.alfresco.web.bean.repository.Repository;
42 import org.alfresco.web.data.IDataContainer;
43 import org.alfresco.web.data.QuickSort;
44 import org.alfresco.web.ui.common.Utils;
45 import org.alfresco.web.ui.common.component.UIActionLink;
46
47 /**
48  * Backing bean for the Preview Space in Template action page
49  *
50  * @author Kevin Roast
51  */

52 public class SpacePreviewBean extends BasePreviewBean
53 {
54    /**
55     * Returns the Space this bean is currently representing
56     *
57     * @return The Space Node
58     */

59    public Node getNode()
60    {
61       return this.browseBean.getActionSpace();
62    }
63    
64    /**
65     * Returns a model for use by a template on the Document Details page.
66     *
67     * @return model containing current document and current space info.
68     */

69    public Map JavaDoc getTemplateModel()
70    {
71       HashMap JavaDoc model = new HashMap JavaDoc(3, 1.0f);
72       
73       FacesContext fc = FacesContext.getCurrentInstance();
74       TemplateNode spaceNode = new TemplateNode(getNode().getNodeRef(),
75               Repository.getServiceRegistry(fc), imageResolver);
76       model.put("space", spaceNode);
77       
78       return model;
79    }
80 }
81
Popular Tags