home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 5.6 KB | 209 lines |
- /*
- * @(#Label.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 symantec.itools.db.beans.binding.Name;
-
- /**
- * A dbAWARE Label.
- * <p>
- * This component can be "bound" to a projection within a relation view
- * so that it automatically gets the values in that relation.
- * <p>
- */
- public class Label extends java.awt.Label implements ProjectionBean
- {
- private String m_labelText;
- private ProjectionBeanHelper m_Helper;
-
- /**
- * Constructs a default Label. By default the label will read: "<dbAWARE Label>".
- * <p>
- * Call setBinding() to bind this component to a projection in a RelationView and
- * auto-set the label text.
- *
- * @see #setBinding
- */
- public Label()
- {
- super("<dbAWARE Label>");
- m_Helper = new ProjectionBeanHelper(this);
- }
-
- /**
- * Constructs a Label with the text.
- * @param s the text for the label
- */
- public Label(String s)
- {
- super();
- m_labelText = s;
- 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 value the RelationView to bind with
- * @see #getRelationView
- * @see #setBinding
- * @see #setProjection
- */
- public void setRelationView(RelationView value) {
- m_Helper.setRelationView(value);
- }
-
-
- /**
- * 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(String value) {
- m_Helper.setTreatBlankAsString(value);
- }
-
- /**
- * Indicates when the component commits its changes.
- * @see #setDynamicUpdate
- */
- public boolean getDynamicUpdate() {
- return m_Helper.getDynamicUpdate();
- }
-
- /**
- * Sets when the component commits its changes.
- * @param value the new dynamic update mode value
- * @see #getDynamicUpdate
- */
- public void setDynamicUpdate(boolean value) {
- m_Helper.setDynamicUpdate(value);
- }
-
- /**
- * Gets the value of this component.
- * @return the current component value
- * @see #setData
- */
- public Object getData() {
- return m_labelText;
- }
-
- /**
- * Sets the value of this component to the given value.
- * @param value the new component value
- * @see #getData
- */
- public void setData(Object value) {
- m_labelText = value.toString();
- setText(m_labelText);
- }
-
- /**
- * 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) {
- }
-
- /**
- * 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();
- }
- }
-