home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / TableCell.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  7.0 KB  |  191 lines

  1. /*
  2.  * Copyright (c) 1997 Krumel & Associates, Inc. All Rights Reserved.
  3.  *
  4.  * www.krumel.com - controls@krumel.com
  5.  *
  6.  * Permission is given to the buyer of this package for one software
  7.  * developer to use this software on one CPU (one workstation) and to make
  8.  * one backup copy.  You may uitilize and/or modify this class for use in your
  9.  * projects.  You may distribute or sell any executable which results from
  10.  * using this code in yur application, except a utility or class of similar
  11.  * nature to this product.  You may distribute this product in compiled
  12.  * form only, but soley to be used with your cmpiled executable product
  13.  * for the puposes of dynamic loading. You may NOT redistribute the source
  14.  * code in any form or make it accessible through a network or other
  15.  * distribution media to others. Please refer to the file "copyright.html"
  16.  * for further important copyright and licensing information.
  17.  *
  18.  * The source code is the confidential and proprietary information
  19.  * of Krumel & Associates, Inc. ("Confidential Information").  You shall
  20.  * not disclose such Confidential Information and shall use it only in
  21.  * accordance with the terms of the license agreement you entered into
  22.  * with Krumel & Associates, Inc..
  23.  
  24.  * KRUMEL & ASSOCIATES MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
  25.  * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
  26.  * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  27.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KRUMEL & ASSOCIATES SHALL NOT
  28.  * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
  29.  * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  30.  */
  31.  
  32. package symantec.itools.db.awt;
  33.  
  34. import java.awt.*;
  35. import symantec.itools.db.awt.event.CellEvent;
  36.  
  37. /**
  38.  * The interface that must be implemented for a class to act as a cell in a
  39.  * TableView.
  40.  * <p>
  41.  * Note: All coordinates are 0 relative.
  42.  */
  43. public interface TableCell extends java.io.Serializable {
  44.     /**
  45.      * Cell type is a regular cell.
  46.      */
  47.     public final static int CELL = 0;
  48.     /**
  49.      * Cell type is a column heading.
  50.      */
  51.     public final static int COL_HEADING = 1;
  52.     /**
  53.      * Cell type for a row heading cell.
  54.      */
  55.     public final static int ROW_HEADING = 2;
  56.     /**
  57.      * Cell type for the corner cell.
  58.      */
  59.     public final static int CORNER_CELL = 3;
  60.  
  61.     /**
  62.      * Allows the cell to set instance variables for view and data source.
  63.      * @param v The TableView the cell is contained within.
  64.      * @param ds The datasource the cell obtains its data.
  65.      */
  66.     public void setTableView(TableView v, DataSource ds);
  67.     /**
  68.      * Sets the cell coordinates for the cell. The coordinate parameter is a
  69.      * shared value, so its values should be copied to another variable of type
  70.      * Coordinate.
  71.      */
  72.     public void setCoordinates(Coordinate c);
  73.     /**
  74.      * Gets the cell coordinates for the cell.
  75.      */
  76.     public Coordinate getCoordinates();
  77.     /**
  78.      * Gets the row number for the cell.
  79.      */
  80.     public int row();
  81.     /**
  82.      * Sets the row number for the cell.
  83.      */
  84.     public void setRow(int r);
  85.     /**
  86.      * Gets the column number for the cell.
  87.      */
  88.     public int col();
  89.     /**
  90.      * Sets the column number for the cell.
  91.      */
  92.     public void setCol(int c);
  93.     /**
  94.      * Called by the TableView when the cell is to be drawn on the screen.
  95.      * @param g The graphics context to perform drawing functions.
  96.      * @param hints Contains the information required for the cell to draw
  97.      *      in the proper place and colors.
  98.      */
  99.     public void drawCell(Graphics g, CellHints hints);
  100.     /**
  101.      * Called when the user triggers a mouse event on the cell.
  102.      */
  103.     public void mouseEvent(CellEvent e);
  104.     /**
  105.      * Called by the TableView when the user triggers a key event while the
  106.      * cell possesses the keyboard focus.
  107.      */
  108.     public void keyEvent(CellEvent e);
  109.     /**
  110.      * Called by the TableView when it hides the auxillary control of the cell.
  111.      */
  112.     public void lostAuxControl();
  113.     /**
  114.      * Called by the TableView when the cell either gains or loses the keyboard focus.
  115.      */
  116.     public void focusEvent(CellEvent e);
  117.     /**
  118.      * Called by the TableView when the cell possess the keyboard focus to query
  119.      * whether the cell's contents are in a valid state so another control may
  120.      * receive the keyboard focus.
  121.      */
  122.     public boolean canLoseFocus();
  123.     /**
  124.      * Called by the TableView when the cell possesses the keyboard focus to
  125.      * query whether an arrow key can move the focus.
  126.      */
  127.     public boolean loseFocusOnArrow();
  128.     /**
  129.      * Queries whether the cell type supports user editing (normally from the
  130.      * keyboard.  If it cannot, the cell will not receive the keyboard focus.
  131.      */
  132.     public boolean isCellTypeEditable();
  133.     /**
  134.      * Informs the cell to draw a cursor if appropriate.  The TableView deactivates
  135.      * the cursor when it loses the keyboard focus.
  136.      */
  137.     public void activateCursor();
  138.     /**
  139.      * Informs the cell not to draw a cursor. The TableView deactivates the cursor
  140.      * when it loses the keyboard focus.
  141.      */
  142.     public void deactivateCursor();
  143.     /**
  144.      * Gets the key statistics of the cell in a String format. Helps with
  145.      * debugging.
  146.      */
  147.     public String stats();
  148.     /**
  149.      * Gets the data object for the cell (Normally retrieved via the data source.
  150.      * @exception DataNotAvailable if the data cannot be accessed
  151.      */
  152.     public Data getData() throws DataNotAvailable;
  153.     /**
  154.      * Gets a copy of the cell suitable for taking the place of the current cell.
  155.      */
  156.     public TableCell cloneCell();
  157.     /**
  158.      * Resets the values of the cell to their default values.  The TableView uses
  159.      * common cells to perform the drawing and event functions.  This allows it to
  160.      * use memory efficiently by not being forced to create a cell for every piece of
  161.      * data stored in a data source.  This function is called when a cell is changed
  162.      * to represent another coordinate position.  Afterwards, the cell's methods are
  163.      * called to set the internal state properly before being asked to process
  164.      * cell events are perform drawing.
  165.      */
  166.     public void reset();
  167.     /**
  168.      * Sets the type of cell.
  169.      * @param t One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
  170.      * @return One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
  171.      */
  172.     public int type(int t);
  173.     /**
  174.      * Gets the type of cell.
  175.      * @return One of CELL, COL_HEADING, ROW_HEADING, CORNER_CELL.
  176.      */
  177.     public int type();
  178.     /**
  179.      * Gets the auxillary control for the cell.
  180.      * @return The widget if the cell supports auxillary controls or null
  181.      *      otherwise.
  182.      */
  183.     public Component auxControl();
  184.  
  185.     /**
  186.      * Sets the cell as a default cell used by the TableView and data
  187.      * sources to conserve resources.
  188.      */
  189.     public void setDefaultFlag();
  190. }
  191.