001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.console.welcome;
019
020 import java.io.IOException;
021 import java.util.ArrayList;
022 import java.util.List;
023 import java.util.StringTokenizer;
024 import java.util.Map;
025 import java.util.TreeMap;
026
027 import javax.portlet.ActionRequest;
028 import javax.portlet.ActionResponse;
029 import javax.portlet.PortletConfig;
030 import javax.portlet.PortletException;
031 import javax.portlet.PortletRequestDispatcher;
032 import javax.portlet.RenderRequest;
033 import javax.portlet.RenderResponse;
034 import javax.portlet.WindowState;
035
036 import org.apache.geronimo.console.BasePortlet;
037 import org.apache.geronimo.console.util.PortletManager;
038
039 public class WelcomePortlet extends BasePortlet {
040
041 private static final String NORMALVIEW_JSP = "/WEB-INF/view/welcome/welcomeNormal.jsp";
042
043 private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/welcome/welcomeMaximized.jsp";
044
045 private static final String HELPVIEW_JSP = "/WEB-INF/view/welcome/welcomeHelp.jsp";
046
047 private PortletRequestDispatcher normalView;
048
049 private PortletRequestDispatcher maximizedView;
050
051 private PortletRequestDispatcher helpView;
052
053 public void processAction(ActionRequest actionRequest,
054 ActionResponse actionResponse) throws PortletException, IOException {
055 }
056
057 protected void doView(RenderRequest renderRequest,
058 RenderResponse renderResponse) throws IOException, PortletException {
059 if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
060 return;
061 }
062
063 if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
064 normalView.include(renderRequest, renderResponse);
065 } else {
066 maximizedView.include(renderRequest, renderResponse);
067 }
068 }
069
070 protected void doHelp(RenderRequest renderRequest,
071 RenderResponse renderResponse) throws PortletException, IOException {
072 helpView.include(renderRequest, renderResponse);
073 }
074
075 public void init(PortletConfig portletConfig) throws PortletException {
076 super.init(portletConfig);
077 normalView = portletConfig.getPortletContext().getRequestDispatcher(
078 NORMALVIEW_JSP);
079 maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
080 MAXIMIZEDVIEW_JSP);
081 helpView = portletConfig.getPortletContext().getRequestDispatcher(
082 HELPVIEW_JSP);
083 }
084
085 public void destroy() {
086 normalView = null;
087 maximizedView = null;
088 helpView = null;
089 super.destroy();
090 }
091
092 }