home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 7.0 KB | 191 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;
-
- import java.awt.*;
- import symantec.itools.db.awt.event.CellEvent;
-
- /**
- * The interface that must be implemented for a class to act as a cell in a
- * TableView.
- * <p>
- * Note: All coordinates are 0 relative.
- */
- public interface TableCell extends java.io.Serializable {
- /**
- * Cell type is a regular cell.
- */
- public final static int CELL = 0;
- /**
- * Cell type is a column heading.
- */
- public final static int COL_HEADING = 1;
- /**
- * Cell type for a row heading cell.
- */
- public final static int ROW_HEADING = 2;
- /**
- * Cell type for the corner cell.
- */
- public final static int CORNER_CELL = 3;
-
- /**
- * Allows the cell to set instance variables for view and data source.
- * @param v The TableView the cell is contained within.
- * @param ds The datasource the cell obtains its data.
- */
- public void setTableView(TableView v, DataSource ds);
- /**
- * Sets the cell coordinates for the cell. The coordinate parameter is a
- * shared value, so its values should be copied to another variable of type
- * Coordinate.
- */
- public void setCoordinates(Coordinate c);
- /**
- * Gets the cell coordinates for the cell.
- */
- public Coordinate getCoordinates();
- /**
- * Gets the row number for the cell.
- */
- public int row();
- /**
- * Sets the row number for the cell.
- */
- public void setRow(int r);
- /**
- * Gets the column number for the cell.
- */
- public int col();
- /**
- * Sets the column number for the cell.
- */
- public void setCol(int c);
- /**
- * Called by the TableView when the cell is to be drawn on the screen.
- * @param g The graphics context to perform drawing functions.
- * @param hints Contains the information required for the cell to draw
- * in the proper place and colors.
- */
- public void drawCell(Graphics g, CellHints hints);
- /**
- * Called when the user triggers a mouse event on the cell.
- */
- public void mouseEvent(CellEvent e);
- /**
- * Called by the TableView when the user triggers a key event while the
- * cell possesses the keyboard focus.
- */
- public void keyEvent(CellEvent e);
- /**
- * Called by the TableView when it hides the auxillary control of the cell.
- */
- public void lostAuxControl();
- /**
- * Called by the TableView when the cell either gains or loses the keyboard focus.
- */
- public void focusEvent(CellEvent e);
- /**
- * Called by the TableView when the cell possess the keyboard focus to query
- * whether the cell's contents are in a valid state so another control may
- * receive the keyboard focus.
- */
- public boolean canLoseFocus();
- /**
- * Called by the TableView when the cell possesses the keyboard focus to
- * query whether an arrow key can move the focus.
- */
- public boolean loseFocusOnArrow();
- /**
- * Queries whether the cell type supports user editing (normally from the
- * keyboard. If it cannot, the cell will not receive the keyboard focus.
- */
- public boolean isCellTypeEditable();
- /**
- * Informs the cell to draw a cursor if appropriate. The TableView deactivates
- * the cursor when it loses the keyboard focus.
- */
- public void activateCursor();
- /**
- * Informs the cell not to draw a cursor. The TableView deactivates the cursor
- * when it loses the keyboard focus.
- */
- public void deactivateCursor();
- /**
- * Gets the key statistics of the cell in a String format. Helps with
- * debugging.
- */
- public String stats();
- /**
- * Gets the data object for the cell (Normally retrieved via the data source.
- * @exception DataNotAvailable if the data cannot be accessed
- */
- public Data getData() throws DataNotAvailable;
- /**
- * Gets a copy of the cell suitable for taking the place of the current cell.
- */
- public TableCell cloneCell();
- /**
- * Resets the values of the cell to their default values. The TableView uses
- * common cells to perform the drawing and event functions. This allows it to
- * use memory efficiently by not being forced to create a cell for every piece of
- * data stored in a data source. This function is called when a cell is changed
- * to represent another coordinate position. Afterwards, the cell's methods are
- * called to set the internal state properly before being asked to process
- * cell events are perform drawing.
- */
- public void reset();
- /**
- * Sets the type of cell.
- * @param t One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
- * @return One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
- */
- public int type(int t);
- /**
- * Gets the type of cell.
- * @return One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
- */
- public int type();
- /**
- * Gets the auxillary control for the cell.
- * @return The widget if the cell supports auxillary controls or null
- * otherwise.
- */
- public Component auxControl();
-
- /**
- * Sets the cell as a default cell used by the TableView and data
- * sources to conserve resources.
- */
- public void setDefaultFlag();
- }
-