tico.board
Class TProject

java.lang.Object
  extended by tico.board.TProject

public class TProject
extends java.lang.Object

Set of TBoards wich can be navigated from an specified initial one.

Version:
1.0 Nov 20, 2006
Author:
Pablo Muñoz

Constructor Summary
TProject()
          Creates a new empty TProject with no initial name.
TProject(java.lang.String name)
          Creates a new empty TProject with the specified initial name.
 
Method Summary
 void addBoard(TBoard board)
          Add a board to the project.
 void addProject(TProject project)
          Add all the boards of project to the project.
 void addProjectChangeListener(ProjectChangeListener listener)
          Adds an ProjectChangeListener.
 TBoard getBoard(int index)
          Returns the project board in the specified index.
 TBoard getBoard(java.lang.String name)
          Returns the project board with the specified name.
 int getBoardCount()
          Returns the number of boards contained by the project
 java.util.ArrayList getBoardList()
          Return an ArrayList with all project boards.
 TBoard getInitialBoard()
          Returns the initialBoard.
 java.lang.String getName()
          Returns the project name.
 boolean isRepeatedName(TBoard board, java.lang.String name)
          Determines if any project board different from board has the specified name.
 boolean isUsedName(java.lang.String name)
          Determines if any project board has the specified name.
static java.lang.String newName()
          Creates a new project name different from any other project name created with this function.
 void removeBoard(TBoard board)
          Removes the specified board from the project.
 void removeProjectChangeListener(ProjectChangeListener listener)
          Removes a ProjectChangeListener.
 void setBoardList(java.util.ArrayList newBoardList)
           
 void setInitialBoard(TBoard initialBoard)
          Sets the initialBoard.
 void setName(java.lang.String name)
          Sets the project name.
static TProject XMLDecode(org.w3c.dom.Element element)
          Returns a TProject object from the data contained in the XML Element.
static TProject XMLDecode(org.w3c.dom.Element element, java.lang.String projectName)
          Returns a TProject object from the data contained in the XML Element.
 org.w3c.dom.Element XMLEncode(org.w3c.dom.Document doc)
          Generates an XML Element that contains the project information.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TProject

public TProject()
Creates a new empty TProject with no initial name.


TProject

public TProject(java.lang.String name)
Creates a new empty TProject with the specified initial name.

Parameters:
name - The specified initial name
Method Detail

getName

public java.lang.String getName()
Returns the project name.

Returns:
The project name

setName

public void setName(java.lang.String name)
Sets the project name.

Parameters:
name - The project name to set

newName

public static java.lang.String newName()
Creates a new project name different from any other project name created with this function.

Returns:
The new project name

addBoard

public void addBoard(TBoard board)
Add a board to the project. The board is renamed if its name is already used by other board of the project. If is the first board of the project, its automatically set as the initialBoard.

Parameters:
board - The board to add

addProject

public void addProject(TProject project)
Add all the boards of project to the project. If any of the new board has a name already used by other board of the project, it is renamed. If this project was empty, the first board of project is set as initialBoard.

Parameters:
project - The project to add

removeBoard

public void removeBoard(TBoard board)
Removes the specified board from the project.

Parameters:
board - The board to delete

getBoardCount

public int getBoardCount()
Returns the number of boards contained by the project

Returns:
The project number of boards

getBoard

public TBoard getBoard(java.lang.String name)
Returns the project board with the specified name.

Parameters:
name - The specified board name
Returns:
The project board with the specified name. If the project does not contain any board with that name, returns null

getBoard

public TBoard getBoard(int index)
Returns the project board in the specified index.

Parameters:
index - The specified board index
Returns:
The project board with the specified name

getInitialBoard

public TBoard getInitialBoard()
Returns the initialBoard.

Returns:
The initialBoard

setInitialBoard

public void setInitialBoard(TBoard initialBoard)
Sets the initialBoard. It initialBoard is not contained in the project, adds it.

Parameters:
initialBoard - The initialBoard to set

isUsedName

public boolean isUsedName(java.lang.String name)
Determines if any project board has the specified name.

Parameters:
name - The specified name
Returns:
true if any project board has the specified name

isRepeatedName

public boolean isRepeatedName(TBoard board,
                              java.lang.String name)
Determines if any project board different from board has the specified name.

Parameters:
board - The board
name - The specified id
Returns:
true if any project board different from board has the specified name

getBoardList

public java.util.ArrayList getBoardList()
Return an ArrayList with all project boards.

Returns:
An ArrayList with all project boards

setBoardList

public void setBoardList(java.util.ArrayList newBoardList)

addProjectChangeListener

public void addProjectChangeListener(ProjectChangeListener listener)
Adds an ProjectChangeListener. The ProjectChangeListener. will receive a ProjectChangeEvent when the project of any of its boards has been changed.

Parameters:
listener - The ProjectChangeListener that is to be notified

removeProjectChangeListener

public void removeProjectChangeListener(ProjectChangeListener listener)
Removes a ProjectChangeListener.

Parameters:
listener - The ProjectChangeListener to remove

XMLEncode

public org.w3c.dom.Element XMLEncode(org.w3c.dom.Document doc)
Generates an XML Element that contains the project information.

Parameters:
doc - The Document that represents the entire XML document
Returns:
The XML Element generated

XMLDecode

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

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

XMLDecode

public static TProject XMLDecode(org.w3c.dom.Element element,
                                 java.lang.String projectName)
                          throws InvalidFormatException
Returns a TProject object from the data contained in the XML Element.

Parameters:
element - The XML Element that contains the project data
projectName - The new TProject project name
Returns:
The generated TProject
Throws:
InvalidFormatException - If Element has an invalid format