KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > ui > portlet > PortletUrlFactory


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Aug 3, 2005
14  * @author James Dixon
15  */

16
17 package org.pentaho.ui.portlet;
18
19 import javax.portlet.PortletMode;
20 import javax.portlet.PortletURL;
21 import javax.portlet.RenderResponse;
22 import javax.portlet.WindowState;
23
24 import org.pentaho.core.ui.IPentahoUrl;
25 import org.pentaho.core.ui.IPentahoUrlFactory;
26
27 public class PortletUrlFactory implements IPentahoUrlFactory {
28
29     private RenderResponse portletResponse;
30
31     private WindowState state;
32
33     private PortletMode mode;
34
35     public PortletUrlFactory(RenderResponse portletResponse, WindowState state, PortletMode mode) {
36         this.portletResponse = portletResponse;
37         this.state = state;
38         this.mode = mode;
39     }
40
41     public IPentahoUrl getActionUrlBuilder() {
42         PortletURL portletUrl = portletResponse.createActionURL();
43         try {
44             portletUrl.setPortletMode(mode);
45         } catch (Exception JavaDoc e) {
46             // TODO log this
47
}
48         try {
49             portletUrl.setWindowState(state);
50         } catch (Exception JavaDoc e) {
51             // TODO log this
52
}
53         try {
54             portletUrl.setSecure(false);
55         } catch (Exception JavaDoc e) {
56             // TODO log this
57
}
58         return new PortletUrl(portletUrl);
59     }
60
61     public IPentahoUrl getDisplayUrlBuilder() {
62         PortletURL portletUrl = portletResponse.createRenderURL();
63         try {
64             portletUrl.setPortletMode(mode);
65         } catch (Exception JavaDoc e) {
66             // TODO log this
67
}
68         try {
69             portletUrl.setWindowState(state);
70         } catch (Exception JavaDoc e) {
71             // TODO log this
72
}
73         try {
74             portletUrl.setSecure(false);
75         } catch (Exception JavaDoc e) {
76             // TODO log this
77
}
78         return new PortletUrl(portletUrl);
79     }
80
81 }
82
Popular Tags