1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.apache.geronimo.console.welcome;
19
20 import java.io.IOException;
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.StringTokenizer;
24 import java.util.Map;
25 import java.util.TreeMap;
26
27 import javax.portlet.ActionRequest;
28 import javax.portlet.ActionResponse;
29 import javax.portlet.PortletConfig;
30 import javax.portlet.PortletException;
31 import javax.portlet.PortletRequestDispatcher;
32 import javax.portlet.RenderRequest;
33 import javax.portlet.RenderResponse;
34 import javax.portlet.WindowState;
35
36 import org.apache.geronimo.console.BasePortlet;
37 import org.apache.geronimo.console.util.PortletManager;
38
39 public class WelcomePortlet extends BasePortlet {
40
41 private static final String NORMALVIEW_JSP = "/WEB-INF/view/welcome/welcomeNormal.jsp";
42
43 private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/welcome/welcomeMaximized.jsp";
44
45 private static final String HELPVIEW_JSP = "/WEB-INF/view/welcome/welcomeHelp.jsp";
46
47 private PortletRequestDispatcher normalView;
48
49 private PortletRequestDispatcher maximizedView;
50
51 private PortletRequestDispatcher helpView;
52
53 public void processAction(ActionRequest actionRequest,
54 ActionResponse actionResponse) throws PortletException, IOException {
55 }
56
57 protected void doView(RenderRequest renderRequest,
58 RenderResponse renderResponse) throws IOException, PortletException {
59 if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
60 return;
61 }
62
63 if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
64 normalView.include(renderRequest, renderResponse);
65 } else {
66 maximizedView.include(renderRequest, renderResponse);
67 }
68 }
69
70 protected void doHelp(RenderRequest renderRequest,
71 RenderResponse renderResponse) throws PortletException, IOException {
72 helpView.include(renderRequest, renderResponse);
73 }
74
75 public void init(PortletConfig portletConfig) throws PortletException {
76 super.init(portletConfig);
77 normalView = portletConfig.getPortletContext().getRequestDispatcher(
78 NORMALVIEW_JSP);
79 maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
80 MAXIMIZEDVIEW_JSP);
81 helpView = portletConfig.getPortletContext().getRequestDispatcher(
82 HELPVIEW_JSP);
83 }
84
85 public void destroy() {
86 normalView = null;
87 maximizedView = null;
88 helpView = null;
89 super.destroy();
90 }
91
92 }