javax.rad.model
Interface IRowDefinition

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
RowDefinition

public interface IRowDefinition
extends java.lang.Cloneable

The IRowDefinition defines the layout of the model. It defines columns by using the ColumnDefinition.

See Also:
ColumnDefinition

Field Summary
static java.lang.String[] ALL_COLUMNS
          A constant for using all columns.
 
Method Summary
 void addColumnDefinition(ColumnDefinition pColumnDefinition)
          Adds the given ColumnDefinition.
 void addControl(IControl pControl)
          Adds the given IControl so that it is notified if the IRowDefinition changes.
 void addDataBook(IDataBook pDataBook)
          Adds the given IDataBook at this IRowDefinition, which means that the given IDataBook is using this IRowDefinition.
 IRowDefinition createRowDefinition(java.lang.String[] pColumnNames)
          Creates a IRowDefinition with only the ColumnDefinitions which have been specified.
 int getColumnCount()
          Gets the count of added ColumnDefinitions.
 ColumnDefinition getColumnDefinition(int pColumnIndex)
          Gets the ColumnDefinition with the given index.
 ColumnDefinition getColumnDefinition(java.lang.String pColumnName)
          Gets the ColumnDefinition with the given name.
 int getColumnDefinitionIndex(java.lang.String pColumnName)
          Gets the index of the ColumnDefinition with the given name.
 int[] getColumnDefinitionIndexes(java.lang.String[] pColumnNames)
          Returns the indexes of the ColumnDefinitions with the given names.
 ColumnDefinition[] getColumnDefinitions()
          Gets all added ColumnDefinitions as array.
 java.lang.String[] getColumnNames()
          Gets the names of all added ColumnDefinitions.
 ColumnView getColumnView(java.lang.Class<? extends IControl> pTargetControl)
          Gets the ColumnView to use for the given IControl.
 java.lang.Class<? extends IControl>[] getColumnViewClasses()
          Gets all classes for which ColumnView are set.
 IControl[] getControls()
          Returns all added IControls.
 IDataBook[] getDataBooks()
          Gets the array if IDataBooks which have been added.
 java.lang.String[] getPrimaryKeyColumnNames()
          Gets the names of all added ColumnDefinitions which represent a primary key column.
 java.lang.String[] getReadOnly()
          Gets the names of the columns which are read only.
 void removeControl(IControl pControl)
          Removes the given IControl.
 void removeDataBook(IDataBook pDataBook)
          Removes the given IDataBook from this IRowDefinition.
 void setColumnView(java.lang.Class<? extends IControl> pTargetControl, ColumnView pColumnView)
          Sets the ColumnView for the given IControl.
 void setPrimaryKeyColumnNames(java.lang.String[] pColumnNames)
          Sets the names of all added ColumnDefinitions which represent a primary key column.
 void setReadOnly(java.lang.String[] pColumnNames)
          Sets that specified columns as read only.
 

Field Detail

ALL_COLUMNS

static final java.lang.String[] ALL_COLUMNS
A constant for using all columns.

Method Detail

addDataBook

void addDataBook(IDataBook pDataBook)
                 throws ModelException
Adds the given IDataBook at this IRowDefinition, which means that the given IDataBook is using this IRowDefinition.

The added IDataBook has to remove itself when appropriate.

Parameters:
pDataBook - the IDataBook to register.
Throws:
ModelException - if adding it was not possible.
See Also:
getDataBooks(), removeDataBook(IDataBook)

removeDataBook

void removeDataBook(IDataBook pDataBook)
Removes the given IDataBook from this IRowDefinition.

The registered IDataBook has to remove itself when appropriate.

Parameters:
pDataBook - the IDataBook to remove.
See Also:
addDataBook(IDataBook), getDataBooks()

getDataBooks

IDataBook[] getDataBooks()
Gets the array if IDataBooks which have been added.

Returns:
the array if IDataBooks which have been added. Note that this array is only a clone and changing it won't change the internal state of the IRowDefinition.
See Also:
addDataBook(IDataBook), removeDataBook(IDataBook)

createRowDefinition

IRowDefinition createRowDefinition(java.lang.String[] pColumnNames)
                                   throws ModelException
Creates a IRowDefinition with only the ColumnDefinitions which have been specified.

If the given column names is null this instance is returned, additionally the instances of the IRowDefinitions can be cached, so that they same instance is returned for the same column names.

Parameters:
pColumnNames - the names of the ColumnDefinitions to copy.
Returns:
a IRowDefinition with only the ColumnDefinitions which have been specified.
Throws:
ModelException - if the IRowDefinition couldn't be constructed.

addColumnDefinition

void addColumnDefinition(ColumnDefinition pColumnDefinition)
                         throws ModelException
Adds the given ColumnDefinition.

Implementations need to check that the given ColumnDefinition is not added to another IRowDefinition. Also it is not allowed to add a ColumnDefinition after an IDataBook has been added.

Parameters:
pColumnDefinition - the ColumnDefinition to add.
Throws:
ModelException - if there is already a ColumnDefinition with that name or if the given ColumnDefinition is already added to another IRowDefinition or a IDataBook has already been added.

getColumnDefinition

ColumnDefinition getColumnDefinition(java.lang.String pColumnName)
                                     throws ModelException
Gets the ColumnDefinition with the given name.

Parameters:
pColumnName - name of the ColumnDefinition to get.
Returns:
the ColumnDefinition with the given name.
Throws:
ModelException - if there is no ColumnDefinition with that name.

getColumnDefinition

ColumnDefinition getColumnDefinition(int pColumnIndex)
Gets the ColumnDefinition with the given index.

Parameters:
pColumnIndex - index of the ColumnDefinition.
Returns:
the ColumnDefinition with the given index.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of bounds.

getColumnDefinitionIndex

int getColumnDefinitionIndex(java.lang.String pColumnName)
Gets the index of the ColumnDefinition with the given name. Returns -1 if there is no ColumnDefinition with the given name.

Parameters:
pColumnName - name of the ColumnDefinition.
Returns:
the index of the ColumnDefinition with the given name, -1 if there is none.
See Also:
getColumnDefinitionIndexes(String[])

getColumnDefinitionIndexes

int[] getColumnDefinitionIndexes(java.lang.String[] pColumnNames)
Returns the indexes of the ColumnDefinitions with the given names.

If any of the given names does not exist, the resulting array will contain -1 at that position.

Parameters:
pColumnNames - the names of the ColumnDefinitions.
Returns:
the indexes of the ColumnDefinitions with the given names, -1 for non existing names.
See Also:
getColumnDefinitionIndex(String)

getColumnCount

int getColumnCount()
Gets the count of added ColumnDefinitions.

Returns:
the count of added ColumnDefinitions.
See Also:
addColumnDefinition(ColumnDefinition)

getColumnDefinitions

ColumnDefinition[] getColumnDefinitions()
Gets all added ColumnDefinitions as array.

The returned array is a copy, so changing the array will not change the IRowDefinition.

Returns:
all added ColumnDefinitions as array.
Since:
2.5

getColumnNames

java.lang.String[] getColumnNames()
Gets the names of all added ColumnDefinitions.

Returns:
the names of all added ColumnDefinitions.
See Also:
addColumnDefinition(ColumnDefinition)

getPrimaryKeyColumnNames

java.lang.String[] getPrimaryKeyColumnNames()
Gets the names of all added ColumnDefinitions which represent a primary key column.

Returns:
the names of all added ColumnDefinitions.
See Also:
getPrimaryKeyColumnNames()

setPrimaryKeyColumnNames

void setPrimaryKeyColumnNames(java.lang.String[] pColumnNames)
                              throws ModelException
Sets the names of all added ColumnDefinitions which represent a primary key column.

Parameters:
pColumnNames - the new String[] with the column names to set the primary key
Throws:
ModelException - if an IDataBook has already been added.
See Also:
getPrimaryKeyColumnNames()

getColumnViewClasses

java.lang.Class<? extends IControl>[] getColumnViewClasses()
Gets all classes for which ColumnView are set.

Returns:
all classes for which ColumnView are set.
See Also:
getColumnView(Class), setColumnView(Class, ColumnView)

getColumnView

ColumnView getColumnView(java.lang.Class<? extends IControl> pTargetControl)
Gets the ColumnView to use for the given IControl. The given IControl class can also be null to get the default ColumnView.

If there is no ColumnView for the given class the default one will be returned.

The ColumnView is stored to the base interface, so it does not matter if you use the interface or the implementing class.

Parameters:
pTargetControl - the class of the IControl for which to get the ColumnView, can be null for the default one.
Returns:
the ColumnView for the given IControl class.
See Also:
getColumnViewClasses(), setColumnView(Class, ColumnView)

setColumnView

void setColumnView(java.lang.Class<? extends IControl> pTargetControl,
                   ColumnView pColumnView)
                   throws ModelException
Sets the ColumnView for the given IControl. The given IControl class can also be null to set the default ColumnView.

The ColumnView is stored to the base interface, so it does not matter if you use the interface or the implementing class.

Parameters:
pTargetControl - the class of the IControl for which to set the ColumnView, can be null to set the default one.
pColumnView - the ColumnView for the given IControl class.
Throws:
ModelException - if any of the column names specified in the ColumnView does not exist in this IRowDefinition.
See Also:
getColumnViewClasses(), getColumnView(Class)

setReadOnly

void setReadOnly(java.lang.String[] pColumnNames)
                 throws ModelException
Sets that specified columns as read only.

Parameters:
pColumnNames - the names of all read only columns, null for all.
Throws:
ModelException - if any of the column names does not exist.
See Also:
getReadOnly()

getReadOnly

java.lang.String[] getReadOnly()
Gets the names of the columns which are read only.

Returns:
the names of the read only columns.
See Also:
setReadOnly(String[])

addControl

void addControl(IControl pControl)
Adds the given IControl so that it is notified if the IRowDefinition changes.

Parameters:
pControl - the IControl to add.
See Also:
getControls(), removeControl(IControl)

removeControl

void removeControl(IControl pControl)
Removes the given IControl.

Parameters:
pControl - the IControl to remove.
See Also:
addControl(IControl), getControls()

getControls

IControl[] getControls()
Returns all added IControls.

Returns:
all added IControls.
See Also:
addControl(IControl), removeControl(IControl)


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.