All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gatein.pc.samples.remotecontroller.RemoteControllerPortlet Maven / Gradle / Ivy

There is a newer version: 2.5.1.Final
Show newest version
/*
 * Copyright (c) 2008, Your Corporation. All Rights Reserved.
 */

package org.gatein.pc.samples.remotecontroller;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
import javax.portlet.ResourceURL;
import javax.portlet.WindowState;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Chris Laprun
 * @version $Revision: 9979 $
 */
public class RemoteControllerPortlet extends GenericPortlet
{
   private static final String ZIPCODE = "zipcode";

   @Override
   protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
   {
      renderResponse.setContentType("text/html");
      PrintWriter printWriter = renderResponse.getWriter();
      String namespace = "n_" + renderResponse.getNamespace();
      printWriter.print("

Open remote control!

"); } @Override protected void doHeaders(RenderRequest renderRequest, RenderResponse renderResponse) { PrintWriter printWriter = null; try { printWriter = renderResponse.getWriter(); String namespace = "n_" + renderResponse.getNamespace(); String remoteWindowName = namespace + "_remote"; printWriter.print(""); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } @Override public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException, IOException { resourceResponse.setContentType("text/html"); PrintWriter writer = resourceResponse.getWriter(); String namespace = "n_" + resourceResponse.getNamespace(); writer.print("\n"); PortletURL url = resourceResponse.createRenderURL(); url.setWindowState(WindowState.MINIMIZED); writer.print("
"); writer.print("
  • "); writer.print("Set value of 'zipcode' public render parameter to:
  • "); url.setParameter(ZIPCODE, "80201"); writer.print("
  • Denver, CO"); url.setParameter(ZIPCODE, "94102"); writer.print("
  • San Francisco, CA"); url.setParameter(ZIPCODE, "20001"); writer.print("
  • Washington, DC"); writer.print("
"); } private String createParentURL(PortletURL url) { return "openLinkInParent('" + url + "')"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy