home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 6.2 KB | 231 lines |
- /*
- * @(#NervousText.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
-
-
- package symantec.itools.db.awt;
-
- import java.util.*;
- import java.sql.*;
- import java.lang.*;
- import symantec.itools.db.net.*;
- import symantec.itools.db.pro.*;
- import java.beans.*;
- import symantec.itools.db.beans.binding.Name;
-
- /**
- * A dbAWARE NervousText component.
- * <p>
- * This component is similar to the basic NervousText component, but can also
- * be "bound" to a projection within a relation view
- * so that it automatically gets the values in that relation.
- * <p>
- *
- * @see symantec.itools.multimedia.NervousText
- */
- public class NervousText extends symantec.itools.multimedia.NervousText implements ProjectionBean
- {
- /**
- * A constant value indicating how an empty string will be saved in the database.
- */
- public final static int Default = 0;
- /**
- * A constant value indicating how an empty string will be saved in the database.
- */
- public final static int Null = 1;
- /**
- * A constant value indicating how an empty string will be saved in the database.
- */
- public final static int Blank = 2;
-
- private ProjectionBeanHelper m_Helper;
- /**
- * Controls when the component commits its changes.
- * Takes no action, as this is a read-only component.
- * @see #getDynamicUpdate
- * @see #setDynamicUpdate
- */
- protected boolean m_DynamicUpdate=false;
-
- /**
- * Constructs a new NervousText component.
- */
- public NervousText()
- {
- super();
- m_Helper = new ProjectionBeanHelper(this);
- }
-
- /**
- * Binds this component to a given projection within the specified
- * relation view.
- *
- * @param relView the relation view to bind with
- * @param projection the projection in relView to bind with
- */
- public void setBinding(RelationView relView, String projection)
- {
- m_Helper.setBinding(relView, projection);
- }
-
- /**
- * Returns the projection in the RelationView that this component is bound with.
- * @see #setBinding
- * @see #setProjection
- */
- public String getProjection() {
- return m_Helper.getProjection();
- }
-
- /**
- * Binds this component to the given projection within the RelationView
- * the component is currently bound with.
- * @see #setBinding
- * @see #getProjection
- * @see #getRelationView
- */
- public void setProjection(String projection) {
- m_Helper.setProjection(projection);
- }
-
- /**
- * Gets the RelationView that this component is bound with.
- * @return the RelationView currently bound with
- * @see #setRelationView
- * @see #setBinding
- * @see #getProjection
- */
- public RelationView getRelationView() {
- return m_Helper.getRelationView();
- }
-
- /**
- * Sets the RelationView that this component is bound with.
- * @param rv the RelationView to bind with
- * @see #getRelationView
- * @see #setBinding
- * @see #setProjection
- */
- public void setRelationView(RelationView rv) {
- m_Helper.setRelationView(rv);
- }
-
- /**
- * Specifies how an empty string will be set when updating data on
- * the dbANYWHERE server.
- *
- * @param blank one of "DEFAULT", "NULL", or "BLANK"
- *
- * @see symantec.itools.db.pro.ProjBinder#setValueFromString(java.lang.String, int, int)
- */
- public void setTreatBlankAs(int value) {
- m_Helper.setTreatBlankAs(value);
- }
-
- /**
- * Indicates when the component commits its changes.
- * @see #setDynamicUpdate
- */
- public boolean getDynamicUpdate() {
- return m_DynamicUpdate;
- }
-
- /**
- * Sets when the component commits its changes.
- * @param value the new dynamic update mode value
- * @see #getDynamicUpdate
- */
- public void setDynamicUpdate(boolean value) {
-
-
- m_DynamicUpdate = value;
- }
-
- /**
- * Sets whether the data value of this component may be modified.
- * @param value <code>true</code> if the value may not be modified,
- * <code>false</code>if the value may be modified
- */
- public void setReadOnly(boolean value) {
- }
-
- /**
- * Sets the value of this component to the given value.
- * @param value the new component value
- * @see #getData
- */
- public void setData(Object value) {
- try {
- if(isPaused())
- {
- setPaused(false);
- setText(value.toString());
- super.setPaused(true);
- repaint();
-
- }
- else setText(value.toString());
-
- }
- catch (Exception ex) {
- m_Helper.raiseException(ex);
- }
- }
-
- /**
- * Gets the value of this component.
- * @return the current component value
- * @see #setData
- */
- public Object getData() {
- return getText();
- }
-
- /**
- * Gets whether this component saves its value as a text String.
- * @return <code>true</code> if the value is saved as text,
- * <code>false</code> otherwise
- */
- public boolean isTextBased() {
- return true;
- }
-
- /**
- * Gets the number of digits to the right of the decimal point for
- * this component's value.
- * @return the number of digits to the right of the decimal point
- */
- public int getScale() {
- return ProjBinder.DEFAULTSCALE;
- }
-
- /**
- * Registers the standard event listener(s) for this component.
- */
- public void registerListeners() {
- }
- /**
- * Sets the name of the data item to bind this component to.
- * @param name the data item name, like "MyTable@MyColumn"
- * @see #getDataBinding
- */
- public void setDataBinding(String name)
- {
- m_Helper.setDataBinding(new Name(name));
- }
-
- /**
- * Gets the name of the data item this component is bound to.
- * @returns the data item name, like "MyTable@MyColumn"
- * @see #setDataBinding
- */
- public String getDataBinding()
- {
- return m_Helper.getDataBinding().getFullName();
- }
-
- }
-