tico.board.components
Class TGrid

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.jgraph.graph.DefaultGraphCell
          extended by tico.board.components.TComponent
              extended by tico.board.components.TGrid
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, org.jgraph.graph.GraphCell

public class TGrid
extends TComponent

Defines a TGrid, its attributes and its children grid cells.

Version:
1.0 Nov 20, 2006
Author:
Pablo Muñoz
See Also:
Serialized Form

Field Summary
static int COLUMNS
          Columns grid order value.
static int CUSTOM
          Custom grid order value.
static double DEFAULT_HORIZONTAL_GAP
          Default horizontal distance between cells
static double DEFAULT_VERTICAL_GAP
          Default vertical distance between cells
static int ROWS
          Rows grid order value.
static int SEQUENTIAL
          Sequential grid order value.
static java.lang.String TYPE
          The TGrid type used as attribute in XML encoding and decoding.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
TGrid(TGridCell[] childs)
          Creates a new TGrid with the specified childs.
 
Method Summary
 TGridCell getCell(int row, int column)
          Returns the gridCell in the specified position.
 int getColumnDimension(int column)
          Returns the number of gridCells in the specified column.
 int getColumnsCount()
          Gets the positions all its grid cells and gets the maximum column value.
 TGridCell getFollowingColumnCell(int column, int position)
          Returns the following gridCell of the specified position in the specified column.
 TGridCell getFollowingRowCell(int row, int position)
          Returns the following gridCell of the specified position in the specified row.
 int getLastColumnRow(int row)
          Returns the last column in the specified row.
 int getLastRowColumn(int column)
          Returns the last row in the specified column.
 int getRowDimension(int row)
          Returns the number of gridCells in the specified row.
 int getRowsCount()
          Gets the positions all its grid cells and gets the maximum row value.
 java.lang.String newId()
          Generates a new id for this component.
 java.util.Map reorderColumns()
          Returns a map with the pairs gridCell - attributeMap to be aplied that must be used when you want to change the order of the grid to COLUMNS.
 java.util.Map reorderRows()
          Returns a map with the pairs gridCell - attributeMap to be aplied that must be used when you want to change the order of the grid to ROWS.
static TGrid XMLDecode(org.w3c.dom.Element element)
          Returns a TGrid object from the data contained in the XML Element.
 org.w3c.dom.Node XMLEncode(org.w3c.dom.Document doc)
          Generates an XML Element that contains the component information.
 
Methods inherited from class tico.board.components.TComponent
getId, toString, XMLDecodeType
 
Methods inherited from class org.jgraph.graph.DefaultGraphCell
changeAttributes, clone, getAttributes, getChildren, setAttributes
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static java.lang.String TYPE
The TGrid type used as attribute in XML encoding and decoding.


SEQUENTIAL

public static final int SEQUENTIAL
Sequential grid order value.

See Also:
Constant Field Values

ROWS

public static final int ROWS
Rows grid order value.

See Also:
Constant Field Values

COLUMNS

public static final int COLUMNS
Columns grid order value.

See Also:
Constant Field Values

CUSTOM

public static final int CUSTOM
Custom grid order value.

See Also:
Constant Field Values

DEFAULT_HORIZONTAL_GAP

public static final double DEFAULT_HORIZONTAL_GAP
Default horizontal distance between cells

See Also:
Constant Field Values

DEFAULT_VERTICAL_GAP

public static final double DEFAULT_VERTICAL_GAP
Default vertical distance between cells

See Also:
Constant Field Values
Constructor Detail

TGrid

public TGrid(TGridCell[] childs)
Creates a new TGrid with the specified childs.

Parameters:
childs - The specified childs
Method Detail

newId

public java.lang.String newId()
Description copied from class: TComponent
Generates a new id for this component.

Specified by:
newId in class TComponent
Returns:
Returns the new id.

getCell

public TGridCell getCell(int row,
                         int column)
Returns the gridCell in the specified position.

Parameters:
row - The specified row
column - The specified column
Returns:
The TGridCell in the specified row and column

getColumnsCount

public int getColumnsCount()
Gets the positions all its grid cells and gets the maximum column value. This value is useful when the order of the grid is ROWS otherwise the value is not porperly the number of columns.

Returns:
Number of columns

getRowsCount

public int getRowsCount()
Gets the positions all its grid cells and gets the maximum row value. This value is useful when the order of the grid is COLUMNS otherwise the value is not porperly the number of rows.

Returns:
Number of rows

getLastColumnRow

public int getLastColumnRow(int row)
Returns the last column in the specified row.

Parameters:
row - The specified row
Returns:
The last column in the specified row

getLastRowColumn

public int getLastRowColumn(int column)
Returns the last row in the specified column.

Parameters:
column - The specified column
Returns:
The last row in the specified column

getColumnDimension

public int getColumnDimension(int column)
Returns the number of gridCells in the specified column.

Parameters:
column - The specified column
Returns:
The number of cells in the specified column

getRowDimension

public int getRowDimension(int row)
Returns the number of gridCells in the specified row.

Parameters:
row - The specified row
Returns:
The number of cells in the specified row

getFollowingRowCell

public TGridCell getFollowingRowCell(int row,
                                     int position)
Returns the following gridCell of the specified position in the specified row.

Parameters:
row - The specified row
position - The specified position
Returns:
The following gridCell of the specified position in the specified row

getFollowingColumnCell

public TGridCell getFollowingColumnCell(int column,
                                        int position)
Returns the following gridCell of the specified position in the specified column.

Parameters:
column - The specified column
position - The specified position
Returns:
The following gridCell of the specified position in the specified column

reorderRows

public java.util.Map reorderRows()
Returns a map with the pairs gridCell - attributeMap to be aplied that must be used when you want to change the order of the grid to ROWS.

Returns:
The map to apply when the grid order changed to ROWS

reorderColumns

public java.util.Map reorderColumns()
Returns a map with the pairs gridCell - attributeMap to be aplied that must be used when you want to change the order of the grid to COLUMNS.

Returns:
The map to apply when the grid order changed to COLUMNS

XMLEncode

public org.w3c.dom.Node XMLEncode(org.w3c.dom.Document doc)
Description copied from class: TComponent
Generates an XML Element that contains the component information.

Specified by:
XMLEncode in class TComponent
Parameters:
doc - The Document represents that represents the entire XML document
Returns:
The XML Element generated

XMLDecode

public static TGrid XMLDecode(org.w3c.dom.Element element)
                       throws InvalidFormatException
Returns a TGrid object from the data contained in the XML Element.

Parameters:
element - The XML Element that contains the grid data
Returns:
The generated TGrid
Throws:
InvalidFormatException - If Element has an invalid format