View Javadoc

1   /*
2    * File:    IWidget.java
3    * Created: 22.10.2006 17:11:19
4    *
5    * Copyright 2006 Michal Burda.
6    *
7    * This program is free software; you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, write to the Free Software
19   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20   */
21  
22  package net.sf.webmancer.widget;
23  
24  import net.sf.webmancer.base.Event;
25  import net.sf.webmancer.model.IModelable;
26  
27  import org.springframework.beans.factory.BeanNameAware;
28  
29  /**
30   * @author Michal Burda
31   */
32  public interface IWidget extends IModelable, BeanNameAware {
33      /**
34       * Return the widget's name.
35       * 
36       * @return the widget's name.
37       */
38      String getBeanName();
39  
40      /**
41       * Handle the given event.
42       * 
43       * @param event an event to be handled.
44       */
45      void handleEvent(Event event);
46  
47      /**
48       * Add the given event to the queue of events to be handled. Implementations often simply
49       * call the putEvent() of the parent widget. Usually, only root widgets hold the event
50       * queue and control the event handling mechanism.
51       * 
52       * @param event an event to be added to the queue of events.
53       */
54      void putEvent(Event event);
55      
56      /**
57       * Get parent widget.
58       * 
59       * @return the parent widget or <code>null</code> if the actual widget is a root.
60       */
61      IWidget getParent();
62      
63      /**
64       * Set the parent of this widget.
65       *
66       * @param parent the parent widget
67       */
68      void setParent(IWidget parent);
69  }