|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.dataset.DataColumn
public class DataColumn
A DataColumn
defines information for values in a single column of a DataTable
.
The DataColumn
doesn't contain an actual value for a column, but rather gives the data type,
and name, and tells us whether the column is required, whether it is writeable, and
whether it is the primary key column for the table. The data type for a value in a DataColumn
is always a Java Class.
A DataColumn
is always associated with a specific DataTable
, usually the DataTable
that
instantiated it.
If a DataColumn
is marked as a primary key, this is for tables with a single
column primary key; multiple-column keys are not supported.
Note as well that a DataColumn
is purely passive and doesn't itself
validate actions against the DataTable
. If the column is required, or if it
is read-only, the DataColumn
will not enforce this, nor will it enforce
uniqueness on primary key columns.
Field Summary | |
---|---|
protected static java.lang.String |
DEFAULT_NAME_PREFIX
Used as a prefix for auto-generated DataColumn names. |
Constructor Summary | |
---|---|
protected |
DataColumn(DataTable table)
Create a new DataColumn. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for any changes to bean properties. |
void |
addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for specific property changes. |
java.lang.Object |
getDefaultValue()
|
java.lang.String |
getExpression()
|
java.lang.String |
getName()
Returns the name of the DataColumn. |
DataTable |
getTable()
Returns the DataTable that this column belongs to. |
java.lang.Class |
getType()
Returns the type of the values for this DataColumn as a Java Class. |
java.lang.Object |
getValueForRow(DataRow row)
|
boolean |
isKeyColumn()
Returns whether the column is a key column or not |
boolean |
isReadOnly()
|
boolean |
isRequired()
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Stops notifying a specific listener of any changes to bean properties. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Stops notifying a specific listener of changes to a specific property. |
void |
setDefaultValue(java.lang.Object defaultValue)
Set the value to use as a default when a new field for this column is created, such as when a new row is created. |
void |
setExpression(java.lang.String expression)
Sets the expression that this column will use to calculate its values. |
void |
setKeyColumn(boolean value)
Sets this column to be a key column. |
void |
setName(java.lang.String name)
Sets the name of the DataColumn. |
void |
setReadOnly(boolean readOnly)
Sets whether this column is read-only or not. |
void |
setRequired(boolean required)
Specifies whether the fields in this column must have a value (cannot be null). |
void |
setType(java.lang.Class type)
Sets the type for the values of this DataColumn as a Java Class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String DEFAULT_NAME_PREFIX
Constructor Detail |
---|
protected DataColumn(DataTable table)
new DataColumn(table)
directly. Rather, call
table.addColumn()
.
table
- cannot be null. The DataTable
that created this
DataColumn.Method Detail |
---|
public DataTable getTable()
DataTable
that this column belongs to.
public java.lang.String getName()
public void setName(java.lang.String name)
DataSetUtils.isValidName(java.lang.String)
.
public java.lang.Class getType()
public void setType(java.lang.Class type)
type
- If null, then the type is set to Object.class.public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly
- If true, column is read-only.public boolean isRequired()
setRequired(boolean)
method,
or if the DataColumn is a keyColumn. public void setRequired(boolean required)
required
- public java.lang.Object getDefaultValue()
public void setDefaultValue(java.lang.Object defaultValue)
defaultValue
- public boolean isKeyColumn()
public void setKeyColumn(boolean value)
value
- public java.lang.String getExpression()
public void setExpression(java.lang.String expression)
expression
property on this column is set, then
the values for each row in the column are determined based on the expression.
This is currently unimplemented. TODO
expression
- the expression for calculating values in this columnpublic java.lang.Object getValueForRow(DataRow row)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to notify of changes to this
instance.public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener to notify of changes to this
instance.property
- The name of the property to listen to changes for.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener to stop receiving notifications.public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- The name of the property to ignore from now on.listener
- The listener to stop receiving notifications.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |