View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16   
17  package org.apache.jetspeed.modules.actions.controls;
18  
19  // Turbine stuff
20  import org.apache.turbine.modules.Action;
21  import org.apache.turbine.util.RunData;
22  
23  // Jetspeed stuff
24  import org.apache.jetspeed.services.rundata.JetspeedRunData;
25  import org.apache.jetspeed.services.resources.JetspeedResources;
26  
27  /***
28   * Display portlet in print friendly format
29   * 
30   * @version $Id: Print.java,v 1.3 2004/02/23 02:50:53 jford Exp $ 
31   * @author <a href="mailto:mark_orciuch@ngsltd.com">Mark Orciuch</a>
32   */
33  public class Print extends Action
34  {
35                                                             
36      /***
37       * Default template to use with print friendly format
38       */
39      private static final String DEFAULT_TEMPLATE = "content";
40  
41      /***
42       * Default template to use with print friendly format
43       */
44      private static final String ACTION_PRINT_TEMPLATE_KEY = "action.print.template";
45  
46      /***
47       * Performs the action
48       * 
49       * @param rundata
50       * @exception Exception
51       */
52      public void doPerform( RunData rundata ) throws Exception
53      {
54  
55          String peid = rundata.getParameters().getString("js_peid");
56          if ( peid == null )
57          {
58              rundata.setScreenTemplate("Ecs");
59              return;
60          }
61  
62           JetspeedRunData jdata = (JetspeedRunData)rundata;
63           jdata.setJs_peid(peid);
64  
65          // retrieve the print friendly format action template
66           String template = JetspeedResources.getString(ACTION_PRINT_TEMPLATE_KEY, DEFAULT_TEMPLATE);
67  
68          // redirect to the content template
69          rundata.setScreenTemplate(template);
70      }
71  }