001 /*
002 * This file is part of the Echo Point Project. This project is a
003 * collection of Components that have extended the Echo Web Application
004 * Framework Version 3.
005 *
006 * Version: MPL 1.1
007 *
008 * The contents of this file are subject to the Mozilla Public License Version
009 * 1.1 (the "License"); you may not use this file except in compliance with
010 * the License. You may obtain a copy of the License at
011 * http://www.mozilla.org/MPL/
012 *
013 * Software distributed under the License is distributed on an "AS IS" basis,
014 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015 * for the specific language governing rights and limitations under the
016 * License.
017 */
018
019 package echopoint.event;
020
021 import echopoint.TagCloud;
022 import echopoint.model.Tag;
023 import nextapp.echo.app.event.ActionEvent;
024
025 /**
026 * An action event that is raised when a user clicks on a {@link
027 * echopoint.model.Tag} in a {@link echopoint.TagCloud} component.
028 *
029 * @author Rakesh 2009-02-19
030 * @version $Id: TagEvent.java 120 2009-02-20 15:43:33Z sptrakesh $
031 */
032 public class TagEvent extends ActionEvent
033 {
034 private static final long serialVersionUID = 1l;
035
036 /** The tag that was clicked leading to the event being raised. */
037 private final Tag tag;
038
039 /**
040 * @param source The object from which the event originated
041 * @param command The action command string describing the action
042 * @param tag The tag that was selected.
043 */
044 public TagEvent( final TagCloud source, final String command, final Tag tag )
045 {
046 super( source, command );
047 this.tag = tag;
048 }
049
050 /**
051 * Return the tag that was clicked to generate the action event.
052 *
053 * @return The tag that was selected.
054 */
055 public Tag getTag()
056 {
057 return tag;
058 }
059
060 /**
061 * Over-ridden to return the properly type-cast component source from
062 * which the event was triggered.
063 *
064 * @return The parent tag cloud component.
065 */
066 @Override
067 public TagCloud getSource()
068 {
069 return (TagCloud) super.getSource();
070 }
071 }