org.fopps.model
Class ProjectContainer

java.lang.Object
  |
  +--org.fopps.model.ProjectContainer
All Implemented Interfaces:
ModelListener

public class ProjectContainer
extends java.lang.Object
implements ModelListener

Class ProjectContainer acts as a container for all projects.


Field Summary
static ProjectItem DUMMY
           
 
Constructor Summary
ProjectContainer()
           
 
Method Summary
 void addListener(ModelListener pListener)
          Adds a listener
 void addProjects(ProjectItem pProjects)
          Adds one element to association Projects
 void beginBatchUpdate()
          Starts a batch update.
 int commitGhostRelations()
          Change all existing ghost relations to 'real' relations
 void endBatchUpdate()
          Finish a batch update and issues all queued events.
protected  void fireProjectAdded(ProjectItem pItem)
          Fires 'added' event
protected  void fireProjectChanged(ProjectItem pItem)
          Fires 'changed' event
protected  void fireProjectRemoved(ProjectItem pItem)
          Fires 'removed' event
 void fixTimings()
          Fixes timings for all projects in container.
 java.util.List getAssets()
          Returns all assets of the container
 int getIndexOfProject(ProjectItem pItem)
          Return the position of a given project item in the container.
 int getOffsetInMonths()
          Returns the offset in months (from start until now) for this container
 java.util.List getProducts()
          Returns all products of the container
 ProjectItem getProjectAt(int index)
           
 java.util.List getProjects()
          Getter Association Projects
 int getStartYear()
           
 int getTotalDuration()
          Returns the total duration of all projects in months
 boolean isBlockEvents()
           
 void modelChanged(ModelEvent ev)
          Handler for change events of projects
 boolean moveDown(ProjectItem pItem)
          Moves an item one position backwards
 boolean moveUp(ProjectItem pItem)
          Moves an item one position forwards
 void notifyListeners(ModelEvent ev)
          Notify all listeners
 java.util.Iterator projectIterator()
          Returns an iterator for the project list.
 void removeAllListener()
          Removes all listeners
 void removeAllProjects()
          Removes one element to association Projects
 int removeGhostRelations()
          Change all existing ghost relations to 'real' relations
 void removeListener(ModelListener pListener)
          Removes a listener
 void removeProjects(ProjectItem pProjects)
          Removes one element to association Projects
 void setBlockEvents(boolean blockEvents)
           
 boolean setContainer(ProjectContainer pContainer)
           
 void setProjects(java.util.Collection pProjects)
          Setter Association Projects
 void setStartYear(int pStartYear)
          Sets a new start year.
 int size()
          Returns number of projects
 boolean swapPosition(ProjectItem p1, ProjectItem p2)
          Swaps positions of two items.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DUMMY

public static ProjectItem DUMMY
Constructor Detail

ProjectContainer

public ProjectContainer()
Method Detail

getStartYear

public int getStartYear()

isBlockEvents

public boolean isBlockEvents()

setBlockEvents

public void setBlockEvents(boolean blockEvents)

setStartYear

public void setStartYear(int pStartYear)
Sets a new start year. All projects will adjusted regarding start and end, feature availability is updated

Parameters:
pStartYear - Start year to set (e. g. 2000 for year 2000. Easy, eh?)

removeGhostRelations

public int removeGhostRelations()
Change all existing ghost relations to 'real' relations

Returns:
Number of changed relations

commitGhostRelations

public int commitGhostRelations()
Change all existing ghost relations to 'real' relations

Returns:
Number of changed relations

fixTimings

public void fixTimings()
Fixes timings for all projects in container.

See Also:
ProjectItem#fixTiming(int,boolean)

beginBatchUpdate

public void beginBatchUpdate()
Starts a batch update. This is useful to change multiple objetcs with updating the view on every change. All events during an batch update are queued and will be issued after the change succeeded.

NoteYou have to call endBatchUpdate() to finish tha update correctly. So you shold enclose your update operations in a try..finally block.


endBatchUpdate

public void endBatchUpdate()
Finish a batch update and issues all queued events. NoteYou have to call beginBatchUpdate() before


getProducts

public java.util.List getProducts()
Returns all products of the container


getAssets

public java.util.List getAssets()
Returns all assets of the container


addListener

public void addListener(ModelListener pListener)
Adds a listener


removeListener

public void removeListener(ModelListener pListener)
Removes a listener


removeAllListener

public void removeAllListener()
Removes all listeners


notifyListeners

public void notifyListeners(ModelEvent ev)
Notify all listeners


setContainer

public boolean setContainer(ProjectContainer pContainer)

getProjects

public java.util.List getProjects()
Getter Association Projects


setProjects

public void setProjects(java.util.Collection pProjects)
Setter Association Projects


addProjects

public void addProjects(ProjectItem pProjects)
Adds one element to association Projects


removeProjects

public void removeProjects(ProjectItem pProjects)
Removes one element to association Projects


removeAllProjects

public void removeAllProjects()
Removes one element to association Projects


getProjectAt

public ProjectItem getProjectAt(int index)

projectIterator

public java.util.Iterator projectIterator()
Returns an iterator for the project list.


size

public int size()
Returns number of projects


fireProjectChanged

protected void fireProjectChanged(ProjectItem pItem)
Fires 'changed' event


fireProjectRemoved

protected void fireProjectRemoved(ProjectItem pItem)
Fires 'removed' event


fireProjectAdded

protected void fireProjectAdded(ProjectItem pItem)
Fires 'added' event


modelChanged

public void modelChanged(ModelEvent ev)
Handler for change events of projects

Specified by:
modelChanged in interface ModelListener
Parameters:
ev - Occurred event
See Also:
ModelEvent

getIndexOfProject

public int getIndexOfProject(ProjectItem pItem)
Return the position of a given project item in the container.

Parameters:
pItem - Item to search for
Returns:
Position of item or -1, if not found

getTotalDuration

public int getTotalDuration()
Returns the total duration of all projects in months


getOffsetInMonths

public int getOffsetInMonths()
Returns the offset in months (from start until now) for this container


swapPosition

public boolean swapPosition(ProjectItem p1,
                            ProjectItem p2)
Swaps positions of two items. If one or both items nott in the container, the method does nothing


moveUp

public boolean moveUp(ProjectItem pItem)
Moves an item one position forwards

Parameters:
pItem - Item to move up
Returns:
true, if move was possible

moveDown

public boolean moveDown(ProjectItem pItem)
Moves an item one position backwards

Parameters:
pItem - Item to move up
Returns:
true, if move was possible

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.