001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.kernel.portlet;
022:
023: import java.io.IOException;
024:
025: import javax.portlet.GenericPortlet;
026: import javax.portlet.PortletException;
027: import javax.portlet.PortletMode;
028: import javax.portlet.RenderRequest;
029: import javax.portlet.RenderResponse;
030: import javax.portlet.WindowState;
031:
032: /**
033: * <a href="LiferayPortlet.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class LiferayPortlet extends GenericPortlet {
039:
040: protected void doDispatch(RenderRequest req, RenderResponse res)
041: throws IOException, PortletException {
042:
043: WindowState state = req.getWindowState();
044:
045: if (!state.equals(WindowState.MINIMIZED)) {
046: PortletMode mode = req.getPortletMode();
047:
048: if (mode.equals(PortletMode.VIEW)) {
049: doView(req, res);
050: } else if (mode.equals(LiferayPortletMode.ABOUT)) {
051: doAbout(req, res);
052: } else if (mode.equals(LiferayPortletMode.CONFIG)) {
053: doConfig(req, res);
054: } else if (mode.equals(PortletMode.EDIT)) {
055: doEdit(req, res);
056: } else if (mode.equals(LiferayPortletMode.EDIT_DEFAULTS)) {
057: doEditDefaults(req, res);
058: } else if (mode.equals(LiferayPortletMode.EDIT_GUEST)) {
059: doEditGuest(req, res);
060: } else if (mode.equals(PortletMode.HELP)) {
061: doHelp(req, res);
062: } else if (mode.equals(LiferayPortletMode.PREVIEW)) {
063: doPreview(req, res);
064: } else if (mode.equals(LiferayPortletMode.PRINT)) {
065: doPrint(req, res);
066: } else {
067: throw new PortletException(mode.toString());
068: }
069: }
070: }
071:
072: protected void doAbout(RenderRequest req, RenderResponse res)
073: throws IOException, PortletException {
074:
075: throw new PortletException("doAbout method not implemented");
076: }
077:
078: protected void doConfig(RenderRequest req, RenderResponse res)
079: throws IOException, PortletException {
080:
081: throw new PortletException("doConfig method not implemented");
082: }
083:
084: protected void doEditDefaults(RenderRequest req, RenderResponse res)
085: throws IOException, PortletException {
086:
087: throw new PortletException(
088: "doEditDefaults method not implemented");
089: }
090:
091: protected void doEditGuest(RenderRequest req, RenderResponse res)
092: throws IOException, PortletException {
093:
094: throw new PortletException("doEditGuest method not implemented");
095: }
096:
097: protected void doPreview(RenderRequest req, RenderResponse res)
098: throws IOException, PortletException {
099:
100: throw new PortletException("doPreview method not implemented");
101: }
102:
103: protected void doPrint(RenderRequest req, RenderResponse res)
104: throws IOException, PortletException {
105:
106: throw new PortletException("doPrint method not implemented");
107: }
108:
109: }
|