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

A 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 the String[] of all column names in this IRowDefintion.
 ColumnView getColumnView(Class<? extends IControl> pTargetControl)
          Returns the column view to use for GUI controls.
 IDataBook[] getDataBooks()
          It returns the list of IDataBooks corresponding to this IRowDefintion.
 ColumnView getDefaultColumnView()
          Returns the default table columns names.
static String[] getDefaultIgnoredColumnNames()
          Gets the list of columns which are not included in the table columns when no specific table columns are set.
 String[] getPrimaryKeyColumnNames()
          Returns the String[] of all column names in the primary key.
 String[] getReadOnly()
          Returns all read only (true) column names.
 void removeDataBook(IDataBook rowDefinitionListener)
          It removes the DataBook reference to this IRowDefinition, which used this IRowDefintion before.
 void setColumnView(Class<? extends IControl> pTargetControl, ColumnView pColumnView)
          Sets the column view to use for GUI controls.
static void setDefaultIgnoredColumnNames(String... pColumnNames)
          Sets a list of columns which are excluded from the table columns when no specific table columns are set.
 void setPrimaryKeyColumnNames(String[] pColumnNames)
          Sets all primary key column names.
 void setReadOnly(String[] pColumnNames)
          Sets the specified column names as read only true.
 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 the String[] of all column names in this IRowDefintion.

Specified by:
getColumnNames in interface IRowDefinition
Returns:
the 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.

getColumnView

public ColumnView getColumnView(Class<? extends IControl> pTargetControl)
Returns the column view to use for GUI controls. The target control class has to be instance of IControl, eg. ITable, ITree, IEditor.

Specified by:
getColumnView in interface IRowDefinition
Parameters:
pTargetControl - the type of target class.
Returns:
the column view to use for GUI controls.

setColumnView

public void setColumnView(Class<? extends IControl> pTargetControl,
                          ColumnView pColumnView)
                   throws ModelException
Sets the column view to use for GUI controls. The target control class has to be instance of IControl, eg. ITable, ITree, IEditor.

Specified by:
setColumnView in interface IRowDefinition
Parameters:
pTargetControl - the type of target class.
pColumnView - the column view to use for GUI controls.
Throws:
ModelException - if the xxxColumnsName (eg.xxx=Table) are not existing in the IRowDefinition.

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.

toString

public String toString()

Overrides:
toString in class Object

getDefaultColumnView

public ColumnView getDefaultColumnView()
Returns the default table columns names.
Thats all columns without the PK columns.

Returns:
the default table columns names.

setDefaultIgnoredColumnNames

public static void setDefaultIgnoredColumnNames(String... pColumnNames)
Sets a list of columns which are excluded from the table columns when no specific table columns are set. The column names are specified with or without wildcard, e.g. *_id. The column names are case insensitive.

Parameters:
pColumnNames - a list of column names to ignore

getDefaultIgnoredColumnNames

public static String[] getDefaultIgnoredColumnNames()
Gets the list of columns which are not included in the table columns when no specific table columns are set.

Returns:
the list of ignored column names
See Also:
setDefaultIgnoredColumnNames(String...)


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.