javax.rad.model
Class ColumnDefinition

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

public class ColumnDefinition
extends Object
implements Serializable, Cloneable

A ColumnDefinition is a description of the data type and other attributes of a table column.

Example:

 
 ColumnDefinition cdName = new ColumnDefinition("name");
 
 // set properties
 cdName.setWidth(10);
 cdName.setLabel("Name");
 cdName.setNull(true);
 cdName.setReadOnly(true);
 cdName.setWritable(false);
 
 // set RowDefinition;
 RowDefinition rdRowDefinition = new RowDefinition();
 cdName.setRowDefinition(rdRowDefinition);  
 
 

See Also:
IRowDefinition, IDataType, Serialized Form

Constructor Summary
ColumnDefinition()
          Constructs a ColumnDefinition.
ColumnDefinition(String pName)
          Constructs a ColumnDefinition with the specified name.
ColumnDefinition(String pName, IDataType pDataType)
          Constructs a ColumnDefinition with the specified name.
 
Method Summary
 ColumnDefinition clone()
          Clone an ColumnDefinition.
 Object[] getAllowedValues()
          Gets the allowed values for this column.
 String getComment()
          Returns the comment for this column.
 IDataType getDataType()
          Returns the IDataType for this ColumnDefinition.
 String getDefaultLabel()
          It creates an default column label.
 Object getDefaultValue()
          Gets the default value of this column.
 String getLabel()
          Returns the label of the column.
 String getName()
          Returns the column name.
 IRowDefinition getRowDefinition()
          Returns the IRowDefinition for this ColumnDefinition.
 int getWidth()
          Returns the size of this column, which is used in GUI control to display.
protected  void invokeRepaintListeners()
          Notifies all controls from the row definition that this column definition has changed.
 boolean isMovable()
          Returns whether this column can be moved.
 boolean isNullable()
          Returns true if values in this column may be null.
 boolean isReadOnly()
          Returns the read only state of this column.
 boolean isResizable()
          Returns whether this column can be resized.
 boolean isWritable()
          Returns whether this column will be stored.
 void setAllowedValues(Object[] pValues)
          Sets the allowed values for this column.
 void setComment(String pComment)
          Sets the comment for this column.
 void setDataType(IDataType pDataType)
          Sets the IDataType for this ColumnDefinition.
 void setDefaultValue(Object pValue)
          Sets the default value of this column.
 void setLabel(String pLabel)
          Sets the label of this column.
 void setMovable(boolean pMoveable)
          Sets whether this column can be moved.
 void setName(String pName)
          Set the name of the column.
 void setNullable(boolean pNullable)
          Sets whether values in this column may be null.
 void setReadOnly(boolean pReadOnly)
          Sets whether this column is read only.
 void setResizable(boolean pResizeable)
          Sets if this column can be resized.
 void setRowDefinition(IRowDefinition pRowDefinition)
          Sets the IRowDefinition for this ColumnDefinition.
 void setWidth(int pDisplaySize)
          Sets the size of this column, which is used in GUI control to display.
 void setWritable(boolean pStorable)
          Sets whether this column will be stored.
 String toString()
          
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnDefinition

public ColumnDefinition()
Constructs a ColumnDefinition.


ColumnDefinition

public ColumnDefinition(String pName)
Constructs a ColumnDefinition with the specified name.

Parameters:
pName - is the for every RowDefinition unique name

ColumnDefinition

public ColumnDefinition(String pName,
                        IDataType pDataType)
Constructs a ColumnDefinition with the specified name.

Parameters:
pName - is the for every RowDefinition unique name
pDataType - is the IDataType of the ColumnDefinition
Method Detail

toString

public String toString()

Overrides:
toString in class Object

clone

public ColumnDefinition clone()
Clone an ColumnDefinition.

Overrides:
clone in class Object
Returns:
a clone of this ColumnDefinition
See Also:
Object.clone()

setRowDefinition

public void setRowDefinition(IRowDefinition pRowDefinition)
                      throws ModelException
Sets the IRowDefinition for this ColumnDefinition. One ColumnDefinition belongs to exact one IRowDefinition.

Parameters:
pRowDefinition - the IRowDefinition where this ColumnDefinition will be added
Throws:
ModelException - if the ColumnDefinition already added to an other RowDefinition
See Also:
IRowDefinition

getRowDefinition

public IRowDefinition getRowDefinition()
Returns the IRowDefinition for this ColumnDefinition. One ColumnDefinition belongs to exact one IRowDefinition.

Returns:
the IRowDefinition where this ColumnDefinition will be added.
See Also:
IRowDefinition

setName

public void setName(String pName)
             throws ModelException
Set the name of the column.

Parameters:
pName - column name
Throws:
ModelException - if the ColumnDefinition already added to another RowDefinition

getName

public String getName()
Returns the column name.

Returns:
the column name

setDataType

public void setDataType(IDataType pDataType)
                 throws ModelException
Sets the IDataType for this ColumnDefinition.

Parameters:
pDataType - the IDataType for this ColumnDefinition.
Throws:
ModelException - if the ColumnDefinition already added to another RowDefinition
See Also:
IDataType

getDataType

public IDataType getDataType()
Returns the IDataType for this ColumnDefinition.

Returns:
ctDataType the IDataType for this ColumnDefinition.
See Also:
IDataType

setNullable

public void setNullable(boolean pNullable)
Sets whether values in this column may be null.

Parameters:
pNullable - true if values in this column may be null.

isNullable

public boolean isNullable()
Returns true if values in this column may be null.

Returns:
true if values in this column may be null.

setWritable

public void setWritable(boolean pStorable)
Sets whether this column will be stored. If the column isWritable() == false, implementations of the IDataBook interface will not store values for this column.

Parameters:
pStorable - true if column will be stored.
See Also:
IDataBook

isWritable

public boolean isWritable()
Returns whether this column will be stored. If the column isWritable() == false, implementations of the IDataBook interface will not store values for this column.

Returns:
true if column will be stored.
See Also:
IDataBook

setLabel

public void setLabel(String pLabel)
Sets the label of this column. Its used as label for GUI controls.

Parameters:
pLabel - the label of the ColumnDefinition

getLabel

public String getLabel()
Returns the label of the column. Its used as label for GUI controls.

Returns:
the label of the column.

setComment

public void setComment(String pComment)
Sets the comment for this column.

Parameters:
pComment - the comment for this column

getComment

public String getComment()
Returns the comment for this column.

Returns:
the comment for this column.

getWidth

public int getWidth()
Returns the size of this column, which is used in GUI control to display.

Returns:
the size of this column, which is used in GUI control to display.

setWidth

public void setWidth(int pDisplaySize)
Sets the size of this column, which is used in GUI control to display.

Parameters:
pDisplaySize - the display size of this column in characters

setMovable

public void setMovable(boolean pMoveable)
Sets whether this column can be moved. Its used by column oriented controls like tables, ...

Parameters:
pMoveable - true if the column can be moved

isMovable

public boolean isMovable()
Returns whether this column can be moved.

Returns:
true if this column can be moved.

setResizable

public void setResizable(boolean pResizeable)
Sets if this column can be resized. Its used by column oriented controls like tables, ...

Parameters:
pResizeable - true if the column can be resized

isResizable

public boolean isResizable()
Returns whether this column can be resized.

Returns:
true if the column can be resized.

setReadOnly

public void setReadOnly(boolean pReadOnly)
Sets whether this column is read only.

Parameters:
pReadOnly - true if this column is read only.

isReadOnly

public boolean isReadOnly()
Returns the read only state of this column.

Returns:
true if this column is read only.

getDefaultLabel

public String getDefaultLabel()
It creates an default column label.

Returns:
the default column label

setDefaultValue

public void setDefaultValue(Object pValue)
Sets the default value of this column.

Parameters:
pValue - the default value

getDefaultValue

public Object getDefaultValue()
Gets the default value of this column.

Returns:
the default value or null if the column has no default value

setAllowedValues

public void setAllowedValues(Object[] pValues)
Sets the allowed values for this column.

Parameters:
pValues - the allowed values or null when any value is allowed

getAllowedValues

public Object[] getAllowedValues()
Gets the allowed values for this column.

Returns:
an Object[] with values, possible for the column.

invokeRepaintListeners

protected void invokeRepaintListeners()
Notifies all controls from the row definition that this column definition has changed. The IControl.notifyRepaint() method will be called.



Copyright © 2009 SIB Visions GmbH. All Rights Reserved.