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 / Data.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  5.0 KB  |  142 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.  
  35. import java.awt.Image;
  36.  
  37. /**
  38.  * This interface serves as the basis for transferring information from a DataSource
  39.  * to a TableCell. Methods are defined for a cell to use obtain and set string and image
  40.  * data.
  41.  */
  42. public interface Data extends java.io.Serializable {
  43.     /**
  44.      * Type flag to indicate the data is string information.
  45.      */
  46.     public static final int STRING = 1;
  47.     /**
  48.      * Type flag to indicate the data is image information.
  49.      */
  50.     public static final int IMAGE = 2;
  51.     /**
  52.      * Type flag to indicate the data is string and image information.
  53.      */
  54.     public static final int IMAGE_STRING = 3;
  55.  
  56.     /**
  57.      * Based type value for subclasses to define their own types of data.
  58.      */
  59.     public static final int USER_TYPE = 100;
  60.  
  61.     /**
  62.      * Gets the value of the type flag to indicate the type of information
  63.      * held by the data object.
  64.      */
  65.     public int type();
  66.     /**
  67.      * Gets whether the data can be modified.
  68.      */
  69.     public boolean isEditable(int row, int col);
  70.     /**
  71.      * Gets whether the data has been changed since last committed.
  72.      */
  73.     public boolean changed();
  74.     /**
  75.      * Requests the value of the data be returned to the last save point.
  76.      */
  77.     public void rollback();
  78.     /**
  79.      * Commits the current data as the current value. This method is normally called
  80.      * by the data source when a commit request was issued.
  81.      * @exception TypeNotSupported if the data source does not support the type of
  82.      *          action requested or is not successful
  83.      */
  84.     public void commit() throws TypeNotSupported;
  85.     /**
  86.      * Gets whether the data supports multiple predefined choice data.
  87.      */
  88.     public boolean supportsChoice();
  89.     /**
  90.      * Gets an array of Data objects that define the predefined values associated
  91.      * with a field.
  92.      * @exception TypeNotSupported if the data source does not support the type of
  93.      *          action requested or is not successful
  94.      */
  95.     public Data[] getChoices() throws TypeNotSupported;
  96.     /**
  97.      * Sets the string value for the data.
  98.      */
  99.     public void setText(String t);
  100.  
  101.     /**
  102.      * Inserts a character into the string data.
  103.      * @param pos The position in the string to insert the character. Follows the
  104.      *      same rules as the StringBuffer class.
  105.      * @param c The character to insert.
  106.      */
  107.     public void insertChar(int pos, char c);
  108.     /**
  109.      * Sets the string value for the field using a character.
  110.      */
  111.     public void setText(char c);
  112.     /**
  113.      * Appends a character to the end of the string data.
  114.      */
  115.     public void appendChar(char c);
  116.     /**
  117.      * Sets the string value to the empty string.
  118.      */
  119.     public void clearText();
  120.     /**
  121.      * Removes a character from the string data for the field.
  122.      */
  123.     public void deleteChar(int pos);
  124.     /**
  125.      * Gets a substring from the string data for the field.
  126.      */
  127.     public String subString(int spos, int epos);
  128.     /**
  129.      * Sets a new image for the field.
  130.      */
  131.     public void setImage(Image i);
  132.     /**
  133.      * Gets the current string value for the field.
  134.      */
  135.     public String toString();
  136.     /**
  137.      * Gets teh current image value for the field.
  138.      */
  139.     public Image toImage();
  140. }
  141.  
  142.