javax.rad.model
Class RowDefinition

java.lang.Object
  extended by javax.rad.model.RowDefinition
All Implemented Interfaces:
Serializable, Cloneable, IRowDefinition

public class RowDefinition
extends Object
implements IRowDefinition, Serializable

An RowDefinition contains all ColumnDefintion's of a DataRow.

Example:

 
 // construct a RowDefinition
 RowDefinition rdRowDefinition = new RowDefinition();
 
 // construct some ColumnDefinitions
 ColumnDefinition cdId   = new ColumnDefinition("id");
 ColumnDefinition cdName = new ColumnDefinition("name");
 
 rdRowDefinition.addColumnDefinition(cdId);             
 rdRowDefinition.addColumnDefinition(cdName);
 
 

See Also:
IRowDefinition, ColumnDefinition, Serialized Form

Constructor Summary
RowDefinition()
           
 
Method Summary
 void addColumnDefinition(ColumnDefinition pColumnDefinition)
          Adds an ColumnDefinition to this IRowDefinition.
 void addDataBook(IDataBook rowDefinitionListener)
          It register and adds a IDataBook to this IRowDefinition, which uses this IRowDefintion.
 IRowDefinition createRowDefinition(String[] pColumnNames)
          Returns a cloned IRowDefinition with only a subset of ColumnDefinitions, specified by a column name String[].
 int getColumnCount()
          Returns the column count of this IRowDefintion.
 ColumnDefinition getColumnDefinition(int pColumnIndex)
          Returns the ColumnDefinition by index.
 ColumnDefinition getColumnDefinition(String pColumnName)
          Returns the ColumnDefinition by name.
 int getColumnDefinitionIndex(String pColumnName)
          Returns the index of the ColumnDefinition name of this IRowDefinition.
 String[] getColumnNames()
          Returns an String[] of all column names in this IRowDefintion.
 IDataBook[] getDataBooks()
          It returns the list of IDataBooks corresponding to this IRowDefintion.
 String[] getDefaultTableColumnNames()
          Returns the default table columns names.
 String[] getEditorColumnNames()
          Returns the column names to use for a GUI detail panel with editors.
 String[] getPrimaryKeyColumnNames()
          Returns the String[] of all column names in the primary key.
 String[] getReadOnly()
          Returns all read only (true) column names.
 String[] getTableColumnNames()
          Returns the column names to use for table oriented GUI controls.
 String[] getTreeColumnNames()
          Returns the column names to use for tree oriented GUI controls.
 void removeDataBook(IDataBook rowDefinitionListener)
          It removes the DataBook reference to this IRowDefinition, which used this IRowDefintion before.
 void setEditorColumnNames(String[] pColumnNames)
          Sets the column names to use for a GUI detail panel with editors.
 void setPrimaryKeyColumnNames(String[] pColumnNames)
          Sets all primary key column names.
 void setReadOnly(String[] pColumnNames)
          Sets the specified column names as read only true.
 void setTableColumnNames(String[] pColumnNames)
          Sets the column names to use for table oriented GUI controls.
 void setTreeColumnNames(String[] pColumnNames)
          Sets the column names to use for tree oriented GUI controls.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowDefinition

public RowDefinition()
Method Detail

addDataBook

public void addDataBook(IDataBook rowDefinitionListener)
                 throws ModelException
It register and adds a IDataBook to this IRowDefinition, which uses this IRowDefintion. The IDataBook implementations has to remove their self in the close() method.

Specified by:
addDataBook in interface IRowDefinition
Parameters:
rowDefinitionListener - the IDataBook to add
Throws:
ModelException - if the xxxColumnsName (eg.xxx=Table) are not existing in the IRowDefinition.

removeDataBook

public void removeDataBook(IDataBook rowDefinitionListener)
It removes the DataBook reference to this IRowDefinition, which used this IRowDefintion before. The IDataBook implementations has to remove their self in the close() method.

Specified by:
removeDataBook in interface IRowDefinition
Parameters:
rowDefinitionListener - the IDataBook to remove

getDataBooks

public IDataBook[] getDataBooks()
It returns the list of IDataBooks corresponding to this IRowDefintion.

Specified by:
getDataBooks in interface IRowDefinition
Returns:
An IDataBook array of currently using this IRowDefinition.

createRowDefinition

public IRowDefinition createRowDefinition(String[] pColumnNames)
                                   throws ModelException
Returns a cloned IRowDefinition with only a subset of ColumnDefinitions, specified by a column name String[].

Specified by:
createRowDefinition in interface IRowDefinition
Parameters:
pColumnNames - column names to use
Returns:
a cloned IRowDefinition with only a subset column names String[].
Throws:
ModelException - if the IRowDefinition couldn't constructed

addColumnDefinition

public void addColumnDefinition(ColumnDefinition pColumnDefinition)
                         throws ModelException
Adds an ColumnDefinition to this IRowDefinition.
Implementation need to check, that this ColumnDefinition is only added in one IRowDefinition. After an IDataBook is registered (at open()) to this IRowDefinition, there is not allowed to add columns.

Specified by:
addColumnDefinition in interface IRowDefinition
Parameters:
pColumnDefinition - the new ColumnDefinition
Throws:
ModelException - if the ColumnDefinition name already exists or if it already added to another IRowDefintion or if an IDataBook is registered (at open()) to the IRowDefinition.

getColumnDefinition

public ColumnDefinition getColumnDefinition(String pColumnName)
                                     throws ModelException
Returns the ColumnDefinition by name.

Specified by:
getColumnDefinition in interface IRowDefinition
Parameters:
pColumnName - name of the ColumnDefinition
Returns:
the ColumnDefinition by name.
Throws:
ModelException - if the ColumnDefinition name not exists.

getColumnDefinition

public ColumnDefinition getColumnDefinition(int pColumnIndex)
Returns the ColumnDefinition by index.

Specified by:
getColumnDefinition in interface IRowDefinition
Parameters:
pColumnIndex - index of the ColumnDefinition
Returns:
the ColumnDefinition by index.

getColumnDefinitionIndex

public int getColumnDefinitionIndex(String pColumnName)
Returns the index of the ColumnDefinition name of this IRowDefinition.

Specified by:
getColumnDefinitionIndex in interface IRowDefinition
Parameters:
pColumnName - name of the ColumnDefinition
Returns:
the index of the ColumnDefinition name of this IRowDefinition, or -1 if it does not exist.

getColumnCount

public int getColumnCount()
Returns the column count of this IRowDefintion.

Specified by:
getColumnCount in interface IRowDefinition
Returns:
the column count of this IRowDefintion.

getColumnNames

public String[] getColumnNames()
Returns an String[] of all column names in this IRowDefintion.

Specified by:
getColumnNames in interface IRowDefinition
Returns:
an String[] of all column names in this IRowDefintion.

getPrimaryKeyColumnNames

public String[] getPrimaryKeyColumnNames()
Returns the String[] of all column names in the primary key.

Specified by:
getPrimaryKeyColumnNames in interface IRowDefinition
Returns:
the String[] of all column names in the primary key.

setPrimaryKeyColumnNames

public void setPrimaryKeyColumnNames(String[] pColumnNames)
                              throws ModelException
Sets all primary key column names.
It isn't allowed to change the primary key after open() the corresponding DataBook or if the DataRow is in use.

Specified by:
setPrimaryKeyColumnNames in interface IRowDefinition
Parameters:
pColumnNames - the new String[] with the column names to set the primary key
Throws:
ModelException - if an IDataBook already registered (at open()) to this IRowdDefinition.

getTableColumnNames

public String[] getTableColumnNames()
Returns the column names to use for table oriented GUI controls.

Specified by:
getTableColumnNames in interface IRowDefinition
Returns:
the column names to use for table oriented GUI controls.

setTableColumnNames

public void setTableColumnNames(String[] pColumnNames)
                         throws ModelException
Sets the column names to use for table oriented GUI controls.

Specified by:
setTableColumnNames in interface IRowDefinition
Parameters:
pColumnNames - the String[] with the column names to use.
Throws:
ModelException - if the xxxColumnsName (eg.xxx=Table) are not existing in the IRowDefinition.

getTreeColumnNames

public String[] getTreeColumnNames()
Returns the column names to use for tree oriented GUI controls.

Specified by:
getTreeColumnNames in interface IRowDefinition
Returns:
the column names to use for tree oriented GUI controls.

setTreeColumnNames

public void setTreeColumnNames(String[] pColumnNames)
Sets the column names to use for tree oriented GUI controls.

Specified by:
setTreeColumnNames in interface IRowDefinition
Parameters:
pColumnNames - the String[] with the column names to use.

getEditorColumnNames

public String[] getEditorColumnNames()
Returns the column names to use for a GUI detail panel with editors.

Specified by:
getEditorColumnNames in interface IRowDefinition
Returns:
the column names to use for a GUI detail panel with editors.

setEditorColumnNames

public void setEditorColumnNames(String[] pColumnNames)
Sets the column names to use for a GUI detail panel with editors.

Specified by:
setEditorColumnNames in interface IRowDefinition
Parameters:
pColumnNames - the String[] with the column names to use.

toString

public String toString()

Overrides:
toString in class Object

getDefaultTableColumnNames

public String[] getDefaultTableColumnNames()
Returns the default table columns names.
Thats all columns without the PK columns.

Returns:
the default table columns names.

setReadOnly

public void setReadOnly(String[] pColumnNames)
                 throws ModelException
Sets the specified column names as read only true.

Specified by:
setReadOnly in interface IRowDefinition
Parameters:
pColumnNames - the column names to use. if null or empty, then all columns are used.
Throws:
ModelException - if one column name doesn't exist.

getReadOnly

public String[] getReadOnly()
Returns all read only (true) column names.

Specified by:
getReadOnly in interface IRowDefinition
Returns:
all read only (true) column names.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.