source: branches/MetisMQI/src/main/java/weka/gui/sql/event/HistoryChangedEvent.java

Last change on this file was 29, checked in by gnappo, 14 years ago

Taggata versione per la demo e aggiunto branch.

File size: 2.4 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 * HistoryChangedEvent.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
27import javax.swing.DefaultListModel;
28
29/**
30 * An event that is generated when a history is modified.
31 *
32 * @see         HistoryChangedListener
33 * @author      FracPete (fracpete at waikato dot ac dot nz)
34 * @version     $Revision: 1.2 $
35 */
36public class HistoryChangedEvent
37  extends EventObject {
38
39  /** for serialization */
40  private static final long serialVersionUID = 7476087315774869973L;
41 
42  /** the name of the history */
43  protected String m_HistoryName;
44 
45  /** the history model */
46  protected DefaultListModel m_History;
47 
48  /**
49   * constructs the event
50   * @param name        the name of the history
51   * @param history     the model of the history
52   */
53  public HistoryChangedEvent( Object source, 
54                              String name, 
55                              DefaultListModel history ) {
56    super(source);
57   
58    m_HistoryName = name;
59    m_History     = history;
60  }
61
62  /**
63   * returns the name of the history
64   */
65  public String getHistoryName() {
66    return m_HistoryName;
67  }
68
69  /**
70   * returns the history model
71   */
72  public DefaultListModel getHistory() {
73    return m_History;
74  }
75
76  /**
77   * returns the event in a string representation
78   * @return        the event in a string representation
79   */
80  public String toString() {
81    String        result;
82
83    result  = super.toString();
84    result  = result.substring(0, result.length() - 1);  // remove "]"
85    result +=   ",name=" + getHistoryName() 
86              + ",history=" + getHistory()
87              + "]";
88
89    return result;
90  }
91}
Note: See TracBrowser for help on using the repository browser.