databionics.project
Class Project

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by databionics.project.Project
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class Project
extends java.util.ArrayList

A Project contains a collection of file slots and the history of jobs. One slot holds one or more filenames and one BDMFile.

See Also:
Serialized Form

Field Summary
protected  java.util.List changeListeners
          List with all classes, which are informed when the files in this project have changed
protected  boolean clean
          flag for a new project - to ask for a name when saving
protected  java.lang.String description
          description of the project
protected  java.util.List history
          list with finished and active jobs
static java.lang.String lineSeparator
          the line separator used for writing a xml-document
protected static org.apache.log4j.Logger log
          log4j logging
protected  Modules modules
          list of modules with tools needed for loading
protected  java.lang.String name
          name of the project
protected  boolean saved
          flag whether anything has changed since the last saving
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Project()
          Default constructor
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds a class to the list of changeListeners
 void addFile(FileType type, BaseFile file, java.lang.String filename)
          Add fileslot for file object and try to load file
protected  void fireChangeListener(javax.swing.event.ChangeEvent changeEvent)
          Informs all classes contained in list changeListeners that something in this project has changed
 java.lang.String getDescription()
          Get description of project
 BaseFile getFileData(FileType type)
          Get data of first filename for slot with FileType type
 java.lang.String getFileName(FileType type)
          Get first filename for slot with FileType type
 java.lang.String getFileName(FileType type, int index)
          Get a filename for slot with FileType type
 FileSlot getFileSlot(FileType type)
          Get FileSlot for FileType type
 java.util.List getHistory()
          Get history with executed jobs
 java.lang.String getName()
          Get name of project
 boolean isClean()
          Get boolean if project has to be named before saving
 boolean isSaved()
          Get boolean if something has changed after last saving
 void load(java.io.InputStream in, java.lang.String filename)
          Load a project from a XML-File
 void load(java.lang.String filename)
          Load a project from a XML-File
 void loadAllInDir(FileType type)
          load all files in same directory as file in slot with FileType type
 void loadNewFromJob(Job job)
          load all files possibly created by a job
 void newProject()
          Creates a new project with empty filesets and empty history
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes a class of list with changeListeners
 void renameFileName(FileType type, java.lang.String filename)
          Rename filename for a filetype and fire ChangeEvent
 void reset()
          Resets the project by invoking the methods:
 void reset(FileType type)
          Reset slot
 void save(java.lang.String filename)
          Saves a project in a XML-document
 void setClean(boolean bool)
          Set if project has to be named before saving
 void setDescription(java.lang.String s)
          Set project's description
 void setFileData(FileType type, BaseFile file)
          Set data for a filetype
 void setFileName(FileType type, java.lang.String filename)
          Set filename for a filetype and fire ChangeEvent
 void setModules(Modules m)
          Set modules
 void setName(java.lang.String s)
          Set project's name
 void setSaved(boolean bool)
          Set if project has changed after last saving
 java.lang.String toXml()
          XML representation of this project
 void useForAll(FileType type)
          Use filename in slot with FileType type for all slots
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

log

protected static org.apache.log4j.Logger log
log4j logging


lineSeparator

public static java.lang.String lineSeparator
the line separator used for writing a xml-document


name

protected java.lang.String name
name of the project


description

protected java.lang.String description
description of the project


history

protected java.util.List history
list with finished and active jobs


changeListeners

protected java.util.List changeListeners
List with all classes, which are informed when the files in this project have changed


clean

protected boolean clean
flag for a new project - to ask for a name when saving


saved

protected boolean saved
flag whether anything has changed since the last saving


modules

protected Modules modules
list of modules with tools needed for loading

Constructor Detail

Project

public Project()
Default constructor

Method Detail

getName

public java.lang.String getName()
Get name of project

Returns:
name of project

getDescription

public java.lang.String getDescription()
Get description of project

Returns:
description of project

getHistory

public java.util.List getHistory()
Get history with executed jobs

Returns:
history

isClean

public boolean isClean()
Get boolean if project has to be named before saving

Returns:
true if project is not yet named

isSaved

public boolean isSaved()
Get boolean if something has changed after last saving

Returns:
true if nothing has changed after last saving

setName

public void setName(java.lang.String s)
Set project's name

Parameters:
s - new name

setDescription

public void setDescription(java.lang.String s)
Set project's description

Parameters:
s - new description

setClean

public void setClean(boolean bool)
Set if project has to be named before saving

Parameters:
bool - true means project is not yet named

setSaved

public void setSaved(boolean bool)
Set if project has changed after last saving

Parameters:
bool - true means nothing has changed after last saving

setModules

public void setModules(Modules m)
Set modules

Parameters:
m - modules

addFile

public void addFile(FileType type,
                    BaseFile file,
                    java.lang.String filename)
Add fileslot for file object and try to load file

Parameters:
file - file object
filename: - path of file

getFileSlot

public FileSlot getFileSlot(FileType type)
Get FileSlot for FileType type

Parameters:
type - FileType of the slot

getFileName

public java.lang.String getFileName(FileType type)
Get first filename for slot with FileType type


getFileName

public java.lang.String getFileName(FileType type,
                                    int index)
Get a filename for slot with FileType type


setFileName

public void setFileName(FileType type,
                        java.lang.String filename)
Set filename for a filetype and fire ChangeEvent

Parameters:
type - of file
filename: - path of file

renameFileName

public void renameFileName(FileType type,
                           java.lang.String filename)
Rename filename for a filetype and fire ChangeEvent

Parameters:
type - of file
filename: - new path of file

getFileData

public BaseFile getFileData(FileType type)
Get data of first filename for slot with FileType type


setFileData

public void setFileData(FileType type,
                        BaseFile file)
Set data for a filetype

Parameters:
type - of file
data - file object

useForAll

public void useForAll(FileType type)
Use filename in slot with FileType type for all slots


loadAllInDir

public void loadAllInDir(FileType type)
load all files in same directory as file in slot with FileType type


loadNewFromJob

public void loadNewFromJob(Job job)
load all files possibly created by a job


reset

public void reset(FileType type)
Reset slot

Parameters:
type - FileType of the specified FileSlot

reset

public void reset()
Resets the project by invoking the methods:


load

public void load(java.lang.String filename)
Load a project from a XML-File

Parameters:
filename - of the XML-file

load

public void load(java.io.InputStream in,
                 java.lang.String filename)
Load a project from a XML-File

Parameters:
filename - of the XML-file

newProject

public void newProject()
Creates a new project with empty filesets and empty history


save

public void save(java.lang.String filename)
Saves a project in a XML-document

Parameters:
filename - the name of the file to be saved

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a class to the list of changeListeners

Parameters:
listener - class which should be added

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a class of list with changeListeners

Parameters:
listener - class which should be removed

fireChangeListener

protected void fireChangeListener(javax.swing.event.ChangeEvent changeEvent)
Informs all classes contained in list changeListeners that something in this project has changed

Parameters:
changeEvent -

toXml

public java.lang.String toXml()
XML representation of this project

Returns:
String for XML-file


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.