| 1 |
/* |
| 2 |
* @(#)SidePaneEvent.java |
| 3 |
* |
| 4 |
* Copyright 2004 JIDE Software Inc. All rights reserved. |
| 5 |
*/ |
| 6 |
package com.jidesoft.swing.event; |
| 7 |
|
| 8 |
import com.jidesoft.swing.SidePaneItem; |
| 9 |
|
| 10 |
import java.awt.*; |
| 11 |
|
| 12 |
/** |
| 13 |
* An <code>AWTEvent</code> that adds support for <code>SidePaneItem</code> objects as the event source. |
| 14 |
* |
| 15 |
* @see com.jidesoft.swing.SidePaneItem |
| 16 |
* @see SidePaneListener |
| 17 |
*/ |
| 18 |
public class SidePaneEvent extends AWTEvent { |
| 19 |
|
| 20 |
public SidePaneEvent(SidePaneItem source, int id) { |
| 21 |
super(source, id); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* The first number in the range of IDs used for <code>SidePaneGroup</code> events. |
| 26 |
*/ |
| 27 |
public static final int SIDE_PANE_FIRST = AWTEvent.RESERVED_ID_MAX + 2100; |
| 28 |
|
| 29 |
/** |
| 30 |
* The last number in the range of IDs used for <code>DockableFrame</code> events. |
| 31 |
*/ |
| 32 |
public static final int SIDE_PANE_LAST = SIDE_PANE_FIRST + 1; |
| 33 |
|
| 34 |
/** |
| 35 |
* This event is delivered when a tab in the <code>SidePaneGroup</code> is selected. |
| 36 |
*/ |
| 37 |
public static final int SIDE_PANE_TAB_SELECTED = SIDE_PANE_FIRST; |
| 38 |
|
| 39 |
/** |
| 40 |
* This event is delivered when a tab in the <code>SidePaneGroup</code> is selected. |
| 41 |
*/ |
| 42 |
public static final int SIDE_PANE_TAB_DESELECTED = 1 + SIDE_PANE_FIRST; |
| 43 |
|
| 44 |
/** |
| 45 |
* Returns a parameter string identifying this event. This method is useful for event logging and for debugging. |
| 46 |
* |
| 47 |
* @return a string identifying the event and its attributes |
| 48 |
*/ |
| 49 |
@Override |
| 50 |
public String paramString() { |
| 51 |
String typeStr; |
| 52 |
switch (id) { |
| 53 |
case SIDE_PANE_TAB_SELECTED: |
| 54 |
typeStr = "SIDE_PANE_TAB_SELECTED"; |
| 55 |
break; |
| 56 |
case SIDE_PANE_TAB_DESELECTED: |
| 57 |
typeStr = "SIDE_PANE_TAB_DESELECTED"; |
| 58 |
break; |
| 59 |
default: |
| 60 |
typeStr = "SIDE_PANE_UNKNOWN"; |
| 61 |
} |
| 62 |
return typeStr; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
/** |
| 67 |
* Returns the originator of the event. |
| 68 |
* |
| 69 |
* @return the <code>SidePaneItem</code> object that originated the event |
| 70 |
*/ |
| 71 |
|
| 72 |
public SidePaneItem getSidePaneItem() { |
| 73 |
return (source instanceof SidePaneItem) ? (SidePaneItem) source : null; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
} |