home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 5.2 KB | 160 lines |
- /*
- * Copyright (c) 1997 Krumel & Associates, Inc. All Rights Reserved.
- *
- * www.krumel.com - controls@krumel.com
- *
- * Permission is given to the buyer of this package for one software
- * developer to use this software on one CPU (one workstation) and to make
- * one backup copy. You may uitilize and/or modify this class for use in your
- * projects. You may distribute or sell any executable which results from
- * using this code in yur application, except a utility or class of similar
- * nature to this product. You may distribute this product in compiled
- * form only, but soley to be used with your cmpiled executable product
- * for the puposes of dynamic loading. You may NOT redistribute the source
- * code in any form or make it accessible through a network or other
- * distribution media to others. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * The source code is the confidential and proprietary information
- * of Krumel & Associates, Inc. ("Confidential Information"). You shall
- * not disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Krumel & Associates, Inc..
-
- * KRUMEL & ASSOCIATES MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
- * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KRUMEL & ASSOCIATES SHALL NOT
- * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
- * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
-
-
- package symantec.itools.db.awt.event;
-
- import java.awt.*;
- import java.awt.event.*;
- import symantec.itools.db.awt.*;
-
- /**
- * The type of event when a user interact with the table view in a way that
- * does not involve a specific cell, such as hitting a button on the toolbar.
- * The original AWT event is maintained by an internal reference so the exact
- * reason for the event can be determined and the TableView's behavior can
- * be highly customized accordingly. All TableEvents are routed to the event
- * handler, the data source, and finally to any registered objects.
- */
- public class TableEvent extends AWTEvent {
- /**
- * The table view that generated the event.
- */
- TableView view;
-
- /**
- * The AWT event that triggered this event.
- */
- AWTEvent event;
-
- /**
- * The event ID.
- */
- int id;
-
- /**
- * An arbitrary paramter.
- */
- Object param;
-
- //-----------------------------------------------------------------------------
- // Event IDs
- //-----------------------------------------------------------------------------
- /**
- * Base table level event ID
- */
- public final static int TABLE_EVENT = 80;
- /**
- * TableView level event for when TableView got focus
- */
- public final static int GOT_FOCUS = TABLE_EVENT + 1;
- /**
- * TableView level event for when TableView lost focus
- */
- public final static int LOST_FOCUS = TABLE_EVENT + 2;
- /**
- * TableView level event for when row inserted
- */
- public final static int INSERT = TABLE_EVENT + 3; //insert row above specified row
- /**
- * TableView level event for when row is deleted
- */
- public final static int DELETE = TABLE_EVENT + 4; //delete specified row
- /**
- * TableView level event for when row is appended
- */
- public final static int APPEND = TABLE_EVENT + 5; //add row to end of data
- /**
- * TableView level event for when row is undeleted
- */
- public final static int UNDELETE = TABLE_EVENT +6;
- /**
- * TableView level event for when row is undeleted
- */
- public final static int TOOLBAR_EVENT = TABLE_EVENT +7;
- /**
- * User table level event ID
- */
- public final static int USER_TABLE_EVENT = TABLE_EVENT +8;
-
- /**
- * Constructs a TableEvent using any AWTEvent.
- */
- public TableEvent(TableView v, AWTEvent e, int id) {
- super(v, id);
- view = v;
- this.id = id;
- event = e;
- }
-
- /**
- * Inherited from java.awt.AWTEvent. Gets the ID of the event.
- */
- public int getID() { return id; }
-
- /**
- * Sets the ID for the event.
- */
- public void setID(int id) {
- this.id = id;
- }
-
- /**
- * Gets the TableView that generated the event. This is usually a TableView object.
- */
- public TableView getView() { return view; }
-
- public Component getToolbarSource() {
- if (id == TOOLBAR_EVENT) {
- return (Component)event.getSource();
- }
-
- return null;
- }
-
- /**
- * Gets the AWTEvent that triggered the firing of the TableEvent.
- */
- public AWTEvent getAWTEvent() { return event; }
-
- /**
- * Gets the paramater of the TableEvent.
- */
- public Object getParamater() { return param; }
-
- public void setParameter(Object o) { param = o; }
-
- public String toString() {
- return "TableEvent: id=" + id + " parameter=" + param + "AWTEvent="
- + event;
- }
- }
-