001: /*
002: * Copyright 2000,2005 wingS development team.
003: *
004: * This file is part of wingS (http://wingsframework.org).
005: *
006: * wingS is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU Lesser General Public License
008: * as published by the Free Software Foundation; either version 2.1
009: * of the License, or (at your option) any later version.
010: *
011: * Please see COPYING for the complete licence.
012: */
013: package org.wings.event;
014:
015: import org.wings.SInternalFrame;
016:
017: import java.awt.*;
018:
019: /**
020: * SInternalFrameEvent: an AWTEvent which adds support for
021: * SInternalFrame objects as the event source.
022: *
023: * @author Holger Engels
024: */
025: public class SInternalFrameEvent extends AWTEvent {
026: /**
027: * The first number in the range of ids used for window events.
028: */
029: public static final int INTERNAL_FRAME_FIRST = 12000;
030:
031: /**
032: * The window opened event. This event is delivered only
033: * the first time a window is made visible.
034: */
035: public static final int INTERNAL_FRAME_OPENED = INTERNAL_FRAME_FIRST;
036:
037: /**
038: * The window closed event. This event is delivered after
039: * the window has been closed as the result of a call to hide or
040: * destroy.
041: */
042: public static final int INTERNAL_FRAME_CLOSED = 1 + INTERNAL_FRAME_FIRST;
043:
044: /**
045: * The window iconified event. This event indicates that the window
046: * was shrunk down to a small icon.
047: */
048: public static final int INTERNAL_FRAME_ICONIFIED = 2 + INTERNAL_FRAME_FIRST;
049:
050: /**
051: * The window deiconified event type. This event indicates that the
052: * window has been restored to its normal size.
053: */
054: public static final int INTERNAL_FRAME_DEICONIFIED = 3 + INTERNAL_FRAME_FIRST;
055:
056: /**
057: * The window maximized event type. This event indicates that keystrokes
058: * and mouse clicks are directed towards this window.
059: */
060: public static final int INTERNAL_FRAME_MAXIMIZED = 4 + INTERNAL_FRAME_FIRST;
061:
062: /**
063: * The window unmaximized event type. This event indicates that keystrokes
064: * and mouse clicks are no longer directed to the window.
065: */
066: public static final int INTERNAL_FRAME_UNMAXIMIZED = 5 + INTERNAL_FRAME_FIRST;
067:
068: /**
069: * The last number in the range of ids used for window events.
070: */
071: public static final int INTERNAL_FRAME_LAST = INTERNAL_FRAME_UNMAXIMIZED;
072:
073: /**
074: * Constructs a SInternalFrameEvent object.
075: *
076: * @param source the SInternalFrame object that originated the event
077: * @param id an integer indicating the type of event
078: */
079: public SInternalFrameEvent(SInternalFrame source, int id) {
080: super (source, id);
081: }
082:
083: /**
084: * Returns a parameter string identifying this event.
085: * This method is useful for event-logging and for debugging.
086: *
087: * @return a string identifying the event and its attributes
088: */
089: public String paramString() {
090: String typeStr;
091: switch (id) {
092: case INTERNAL_FRAME_OPENED:
093: typeStr = "INTERNAL_FRAME_OPENED";
094: break;
095: case INTERNAL_FRAME_CLOSED:
096: typeStr = "INTERNAL_FRAME_CLOSED";
097: break;
098: case INTERNAL_FRAME_ICONIFIED:
099: typeStr = "INTERNAL_FRAME_ICONIFIED";
100: break;
101: case INTERNAL_FRAME_DEICONIFIED:
102: typeStr = "INTERNAL_FRAME_DEICONIFIED";
103: break;
104: case INTERNAL_FRAME_MAXIMIZED:
105: typeStr = "INTERNAL_FRAME_MAXIMIZED";
106: break;
107: case INTERNAL_FRAME_UNMAXIMIZED:
108: typeStr = "INTERNAL_FRAME_UNMAXIMIZED";
109: break;
110: default:
111: typeStr = "unknown type";
112: }
113: return typeStr;
114: }
115:
116: /**
117: * Returns the originator of the event.
118: *
119: * @return the SInternalFrame object that originated the event
120: * @since 1.3
121: */
122: public SInternalFrame getInternalFrame() {
123: return (source instanceof SInternalFrame) ? (SInternalFrame) source
124: : null;
125: }
126:
127: }
|