KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > event > SRequestEvent


1 /*
2  * $Id: SRequestEvent.java,v 1.5 2004/12/01 07:54:08 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.event;
15
16 import org.wings.externalizer.ExternalizedResource;
17
18 import java.awt.*;
19
20 /**
21  * @author <a HREF="mailto:haaf@mercatis.de">Armin Haaf</a>
22  * @version $Revision: 1.5 $
23  */

24 public class SRequestEvent extends AWTEvent {
25
26
27     public static final int DELIVER_START = 50000;
28
29
30     public static final int DELIVER_DONE = DELIVER_START + 1;
31
32
33     public static final int DISPATCH_START = DELIVER_START + 2;
34
35
36     public static final int DISPATCH_DONE = DELIVER_START + 3;
37
38
39     public static final int PROCESS_REQUEST = DELIVER_START + 4;
40
41
42     public static final int REQUEST_START = DELIVER_START + 5;
43
44
45     public static final int REQUEST_END = DELIVER_START + 6;
46
47     /**
48      * if type is {@link #DELIVER_START} or {@link #DELIVER_DONE} this field is
49      * filled with info about the resource actually delivered, otherwise it is
50      * null.
51      */

52     protected ExternalizedResource requestedResource;
53
54     /**
55      * Constructs a ComponentEvent object.
56      *
57      * @param aSource the Component object that originated the event
58      * @param type an integer indicating the type of event
59      */

60     public SRequestEvent(Object JavaDoc aSource, int type, ExternalizedResource requestedResource) {
61         super(aSource, type);
62
63         this.requestedResource = requestedResource;
64     }
65
66
67     public int getType() {
68         return getID();
69     }
70
71
72     public ExternalizedResource getRequestedResource() {
73         return requestedResource;
74     }
75
76     /**
77      * Returns a string representing the state of this event. This
78      * method is intended to be used only for debugging purposes, and the
79      * content and format of the returned string may vary between
80      * implementations. The returned string may be empty but may
81      * not be <tt>null</tt>.
82      */

83     public String JavaDoc paramString() {
84         if (getSource() == null)
85             return "no source";
86
87         String JavaDoc typeStr;
88
89         switch (getID()) {
90             case DISPATCH_START:
91                 typeStr = "DISPATCH_START";
92                 break;
93             case DISPATCH_DONE:
94                 typeStr = "DISPATCH_DONE";
95                 break;
96             case DELIVER_START:
97                 typeStr = "DELIVER_START";
98                 break;
99             case DELIVER_DONE:
100                 typeStr = "DELIVER_DONE";
101                 break;
102             default:
103                 typeStr = "unknown type";
104         }
105         return typeStr;
106     }
107
108     public String JavaDoc toString() {
109         return "SRequestEvent[source=" + source + "; " + paramString() + "]";
110     }
111 }
112
Popular Tags