1 package org.apache.jetspeed.modules.actions.portlets; 2 3 import org.apache.jetspeed.portal.portlets.AbstractVTLPortlet; 4 5 import org.apache.turbine.util.RunData; 7 8 import org.apache.velocity.context.Context; 10 11 12 17 public class HelloPortlet extends AbstractVTLPortletAction 18 { 19 private final static String DEFAULT_SALUDO = "Welcome"; 20 private final static String DEFAULT_ANONIMO = "Welcome anonymous"; 21 22 public void setConfigureContent( AbstractVTLPortlet xPortlet, Context context, RunData rundata ) 24 { 25 String saludo = xPortlet.getAttribute( "saludo", DEFAULT_SALUDO, rundata ); 26 27 context.put( "vtlTemplate", "HelloConfigPortlet" ); 29 context.put( "saludo", saludo ); 30 } 31 32 public void setMaximizedContent( AbstractVTLPortlet xPortlet, Context context, RunData rundata, boolean loggedUser ) 34 { 35 String saludo = xPortlet.getAttribute( "saludo", loggedUser ? DEFAULT_SALUDO : DEFAULT_ANONIMO, rundata ); 36 37 saludo = "<font style='font-size: 40pt; '>" + saludo + "</font>"; 39 context.put( "saludo", saludo ); 40 } 41 42 public void setMinimizedContent( AbstractVTLPortlet xPortlet, Context context, RunData rundata ) 44 { 45 String saludo = xPortlet.getAttribute( "saludo", DEFAULT_SALUDO, rundata ); 46 47 xPortlet.setTitle( saludo ); 49 } 50 51 public void setNormalContent( AbstractVTLPortlet xPortlet, Context context, RunData rundata, boolean loggedUser ) 53 { 54 String saludo = xPortlet.getAttribute( "saludo", loggedUser ? DEFAULT_SALUDO : DEFAULT_ANONIMO, rundata ); 55 56 context.put( "saludo", saludo ); 58 } 59 60 } | Popular Tags |