source: src/main/java/weka/gui/sql/event/ResultChangedEvent.java @ 20

Last change on this file since 20 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 3.2 KB
Line 
1/*
2 *    This program is free software; you can redistribute it and/or modify
3 *    it under the terms of the GNU General Public License as published by
4 *    the Free Software Foundation; either version 2 of the License, or
5 *    (at your option) any later version.
6 *
7 *    This program is distributed in the hope that it will be useful,
8 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 *    GNU General Public License for more details.
11 *
12 *    You should have received a copy of the GNU General Public License
13 *    along with this program; if not, write to the Free Software
14 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 * ResultChangedEvent.java
19 * Copyright (C) 2005 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.gui.sql.event;
24
25import java.util.EventObject;
26
27/**
28 * An event that is generated when a different Result is activated in the
29 * ResultPanel.
30 *
31 * @see         ResultChangedListener
32 * @author      FracPete (fracpete at waikato dot ac dot nz)
33 * @version     $Revision: 1.2 $
34 */
35public class ResultChangedEvent
36  extends EventObject {
37
38  /** for serialization */
39  private static final long serialVersionUID = 36042516077236111L;
40 
41  /** the query that is associated with the active result table */
42  protected String m_Query;
43
44  /** the connect string with which the query was run */
45  protected String m_URL;
46
47  /** the user that was used to connect to the DB */
48  protected String m_User;
49
50  /** the password that was used to connect to the DB */
51  protected String m_Password;
52
53  /**
54   * constructs the event
55   * @param source        the source that generated this event
56   * @param url           the current database url
57   * @param user          the current user
58   * @param pw            the current password
59   * @param query         the current query
60   */
61  public ResultChangedEvent(Object source, 
62                            String url,
63                            String user,
64                            String pw,
65                            String query ) {
66    super(source);
67
68    m_URL      = url;
69    m_User     = user;
70    m_Password = pw;
71    m_Query    = query;
72  }
73
74  /**
75   * returns the database URL that produced the table model
76   */
77  public String getURL() {
78    return m_URL;
79  }
80
81  /**
82   * returns the user that produced the table model
83   */
84  public String getUser() {
85    return m_User;
86  }
87
88  /**
89   * returns the password that produced the table model
90   */
91  public String getPassword() {
92    return m_Password;
93  }
94
95  /**
96   * returns the query that was executed
97   */
98  public String getQuery() {
99    return m_Query;
100  }
101
102  /**
103   * returns the event in a string representation
104   * @return        the event in a string representation
105   */
106  public String toString() {
107    String        result;
108
109    result  = super.toString();
110    result  = result.substring(0, result.length() - 1);  // remove "]"
111    result +=   ",url=" + getURL() 
112              + ",user=" + getUser()
113              + ",password=" + getPassword().replaceAll(".", "*")
114              + ",query=" + getQuery()
115              + "]";
116
117    return result;
118  }
119}
Note: See TracBrowser for help on using the repository browser.