home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 4.3 KB | 117 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.event.*;
- import java.awt.*;
- import symantec.itools.db.awt.*;
-
- /**
- * Adapter class for TableView toolbar components. Usually, the TableView
- * will only be concerned with action events generated by the toolbar
- * components, most of which are buttons or TextFields. Consequently,
- * constructors are provided for automatically registering the adapter
- * with these types of components. Whenever a component fires an action
- * event, the adapter calls TableView.toolbarActionPerformed().
- */
- public class ToolbarAdapter implements ActionListener {
- /**
- * The TableView this adapter notifies when toolbar event occurs.
- */
- protected TableView view;
-
- /**
- * Constucts a ToolbarAdapter instance that will fire a notification
- * to the TableView each time another component fires an action event.
- * It is the responsibility of the creating object to register this
- * adapter with the Component that will fire the action events. This
- * constructor is usually utilized by subclasses for Components not supported
- * by one of the other constuctors.
- */
- public ToolbarAdapter(TableView v) {
- view = v;
- }
-
- /**
- * Constucts a ToolbarAdapter instance that will fire a notification
- * to the TableView each time the Button fires an action event.
- */
- public ToolbarAdapter(Button b, TableView v) {
- view = v;
- b.addActionListener(this);
- }
-
- /**
- * Constucts a ToolbarAdapter instance that will fire a notification
- * to the TableView each time the TextField fires an action event.
- */
- public ToolbarAdapter(java.awt.TextField tf, TableView v) {
- view = v;
- tf.addActionListener(this);
- }
-
- /**
- * Adds this instance as an action listener to a Button.
- */
- public void add(Button b) {
- b.addActionListener(this);
- }
-
- /**
- * Removes this instance as an action listener to a Button.
- */
- public void remove(Button b) {
- b.removeActionListener(this);
- }
-
- /**
- * Adds this instance as an action listener to a TextField.
- */
- public void add(java.awt.TextField tf) {
- tf.addActionListener(this);
- }
-
- /**
- * Removes this instance as an action listener to a TextField.
- */
- public void remove(java.awt.TextField tf) {
- tf.removeActionListener(this);
- }
-
- /**
- * Implements the method defined in ActionListener. Calls the TableView
- * method toolbarActionPerformed().
- */
- public void actionPerformed(ActionEvent e) {
- view.toolbarActionPerformed(e);
- }
- }