ActionEvent.java :  » Portal » jportlet » net » sf » jportlet » portlet » event » Java Open Source

Java Open Source » Portal » jportlet 
jportlet » net » sf » jportlet » portlet » event » ActionEvent.java
/*
 * Created on Mar 18, 2003
 */
package net.sf.jportlet.portlet.event;

import net.sf.jportlet.portlet.PortletURI;


/**
 * An <code>ActionEvent</code> is sent by the portlet container when an HTTP
 * request is received that is associated with an action
 *
 * @author <a href="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
 */
public interface ActionEvent
    extends Event
{
    //~ Static fields/initializers ---------------------------------------------

    /** Name of the action if the portlet in {@link net.sf.jportlet.portlet.Portlet.Mode#CONFIGURE} mode */
    public static String ACTION_CONFIGURE = "configure";

    /** Name of the action if the portlet in {@link net.sf.jportlet.portlet.Portlet.Mode#EDIT} mode */
    public static String ACTION_EDIT = "edit";

    /** Name of the action if the portlet in {@link net.sf.jportlet.portlet.Portlet.Mode#HELP} mode */
    public static String ACTION_HELP = "help";

    /** Name of the action if the portlet in {@link net.sf.jportlet.portlet.Portlet.Mode#VIEW} mode */
    public static String ACTION_VIEW = "view";

    /** Code to return if an error has occured while perfoming the action */
    public static String RETURN_ERROR = "error";

    /** Code to return if performing the action was successfull */
    public static String RETURN_SUCCESS = "success";

    /** Code to return if mode input data are required */
    public static String RETURN_INPUT = "input";

    //~ Methods ----------------------------------------------------------------

    /**
     * Add an error.
     * @return Collection
     */
    public void addError( Object error );

    /**
     * Return <code>true</code> if the action has errors
     * @return boolean
     */
    public boolean hasErrors(  );

    /**
     * Returns the action that this action event carries.
     * The action value is either {@link #ACTION_VIEW} or {@link #ACTION_EDIT}
     * or {@link #ACTION_CONFIGURE} or {@link #ACTION_HELP}
     *
     * @return PortletAction
     */
    public String getAction(  );

    /**
     * Returns the returnCode.
     * The <code>returnCode</code> is used by the container for managing the 
     * navigation using the <code>&lt;webflow></code> tag from the portlet
     * deployment descriptor, if the <code>nextURI</code> 
     * was not set with {@link #setNextURI(net.sf.jportlet.portlet.PortletURI)}.
     * 
     * @return String
     */
    public String getReturnCode(  );
    
    /**
     * Return the URI where to move after the action is executed. If not set,
     * the container will used {@link #getReturnCode()} to determine the URI where to move.
     * This is useful for managing navigation inside the portlet.
     * 
     * @return PortletURI
     */
    public PortletURI getNextURI();

    /**
     * Set the returnCode.
     *
     * @param returnCode
     * @see #RETURN_SUCCESS
     * @see #RETURN_ERROR
     * @see #RETURN_INPUT
     */
    public void setReturnCode( String returnCode );
    
    /**
     * Set the URI where to move after the action is executed
     *
     * @param uri next URI
     */
    public void setNextURI( PortletURI nextURI );
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.