Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sunwheeltech/sirius/TreeBrowserEvent.java


1   package com.sunwheeltech.sirius;
2   /* GPL
3   ulunum java libraries for complex simulation modelling, 
4   3d graphics, peer-to-peer networking and other purposes
5   
6   version 0.1 released December 2001
7   see the file contents.html for a quick description of whats in
8   each package, and what you can expect to do with it
9   
10  Copyright (C) December 2001 Dave Crane  dave@cranepeople.co.uk
11  
12  
13  Find the GNU public license at:
14  
15    http://www.gnu.org/copyleft/gpl.html
16   
17  This program is free software; you can redistribute it and/or
18  modify it under the terms of the GNU General Public License
19  as published by the Free Software Foundation; either version 2
20  of the License, or (at your option) any later version. 
21  
22  This program is distributed in the hope that it will be useful,
23  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  GNU General Public License for more details. 
26  
27  You should have received a copy of the GNU General Public License
28  along with this program; if not, write to the Free Software
29  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30  */
31  
32  
33  import ulu.view.*;
34  import ulu.view.io.*;
35  import ulu.view.ui.*;
36  import ulu.view.sys.fs.*;
37  import ulu.view.sys.refl.*;
38  import ulu.view.ui.sirius.*;
39  
40  import ulu.ut.*;
41  import dog.gui.*;
42  import java.awt.*;
43  import java.awt.event.*;
44  import java.beans.*;
45  import java.io.*;
46  import java.net.*;
47  import java.util.*;
48  /**
49   * <p> Wrapper event type for Uncle Unc item tree events, that presents the affected item in the tree and the
50   * underlying event. It declkares te Item as its source, but also offers a convenience getter to avoid class
51   * casting. Can query the underlying event for its source if required.
52   *
53   * @author Dave Crane  Sunwheel Technologies Ltd  June 2003
54   */
55  public class TreeBrowserEvent
56  extends EventObject{
57  
58    /** the Uncle Unc Item behind the event */
59    Item item=null;
60    /** get the Item behind the event 
61    @return the Uncle Unc framework Item object referenced by the event */
62    public Item getItem(){ return item; }
63  
64    /** convenience helper to get the underlying object referenced by the Item
65    @return the underlying object, potentially anything (including null) depending on the framework
66      setup. For the ObjectBrowser bean, this will return the object being exposed by the bean, or one
67      of its child nodes
68    */
69    public Object getItemReference(){ 
70      Object ret=null;
71      try{ ret=item.getReference(); }catch (Exception ex){}
72      return ret;
73    }
74   
75    /** convenience helper to get the name of the Item
76    @return the Item's display name
77    */
78    public String getItemName(){ 
79      String ret=null;
80      try{ ret=item.getName(); }catch (Exception ex){}
81      return ret;
82    }
83   
84    /** the underlying event object (usually an AWT event, but lets be broad-minded */
85    EventObject event=null;
86    /** get the underlying event object */
87    public EventObject getEvent(){ return event; }  
88  
89    /** constructor requires the parent event and item */
90    public TreeBrowserEvent(Item it,EventObject ev){
91      super(it);
92      this.item=it;
93      this.event=ev;
94    }
95  }