ucl.physiol.neuroconstruct.project
Class Project

java.lang.Object
  extended by ucl.physiol.neuroconstruct.project.Project
All Implemented Interfaces:
EventListener, TableModelListener

public class Project
extends Object
implements TableModelListener

Main class holding references to the important data objects of the project

Author:
Padraig Gleeson

Field Summary
 BasicProjectInfo basicProjectInfo
          These hold the main info of the project.
 CellGroupsInfo cellGroupsInfo
           
 CellManager cellManager
          This will be fed with info on the cell morphologies in the projectMorphologies folder
 CellMechanismInfo cellMechanismInfo
           
 ElecInputInfo elecInputInfo
           
 GeneratedCellPositions generatedCellPositions
          Holders for the generated cell positions info, etc.
 GeneratedElecInputs generatedElecInputs
           
 GeneratedNetworkConnections generatedNetworkConnections
           
 GeneratedPlotSaves generatedPlotSaves
           
 GenesisFileManager genesisFileManager
           
 GenesisSettings genesisSettings
           
 SimpleNetworkConnectionsInfo morphNetworkConnectionsInfo
           
 NeuroMLFileManager neuromlFileManager
          Generators of the scripts for NeuroML
 NeuronFileManager neuronFileManager
          Generators of the main code for NEURON and GENESIS
 NeuronSettings neuronSettings
           
 Display3DProperties proj3Dproperties
           
static int PROJECT_EDITED_NOT_SAVED
           
static int PROJECT_NOT_INITIALISED
           
static int PROJECT_NOT_YET_EDITED
           
static int PROJECT_SAVED
           
 ProjectProperties projProperties
           
 PsicsFileManager psicsFileManager
           
 PsicsSettings psicsSettings
           
 PynnFileManager pynnFileManager
           
 RegionsInfo regionsInfo
           
 SimConfigInfo simConfigInfo
           
 SimPlotInfo simPlotInfo
           
 SimulationParameters simulationParameters
           
 ArbourConnectionsInfo volBasedConnsInfo
           
 
Method Summary
 void checkAboutAA()
           
static Project createNewProject(String projectDir, String projectName, ProjectEventListener projectEventListner)
          Gets a new empty project
static ProjectEventListener getDummyProjectEventListener()
          Only for testing purposes!!
 String getProjectDescription()
           
 File getProjectFile()
           
 String getProjectFileName()
           
 String getProjectFileVersion()
           
 String getProjectFullFileName()
           
 File getProjectMainDirectory()
           
 String getProjectName()
           
 int getProjectStatus()
           
 String getProjectStatusAsString()
           
static Project loadProject(File projectFile, ProjectEventListener projectEventListner)
          Gets the project object for a specified project file
static void main(String[] args)
           
 void markProjectAsEdited()
           
 void resetGenerated()
           
 void saveProject()
          Might be a better place for this...
 void setProjectDescription(String projectDescription)
          Put here so we can watch for changes
 void setProjectFileVersion(String pfv)
           
 void setProjectName(String projectName)
           
 void tableChanged(TableModelEvent e)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROJECT_NOT_INITIALISED

public static final int PROJECT_NOT_INITIALISED
See Also:
Constant Field Values

PROJECT_NOT_YET_EDITED

public static final int PROJECT_NOT_YET_EDITED
See Also:
Constant Field Values

PROJECT_SAVED

public static final int PROJECT_SAVED
See Also:
Constant Field Values

PROJECT_EDITED_NOT_SAVED

public static final int PROJECT_EDITED_NOT_SAVED
See Also:
Constant Field Values

basicProjectInfo

public BasicProjectInfo basicProjectInfo
These hold the main info of the project. They will be written to/read from file when saving/loading


cellGroupsInfo

public CellGroupsInfo cellGroupsInfo

regionsInfo

public RegionsInfo regionsInfo

morphNetworkConnectionsInfo

public SimpleNetworkConnectionsInfo morphNetworkConnectionsInfo

volBasedConnsInfo

public ArbourConnectionsInfo volBasedConnsInfo

simulationParameters

public SimulationParameters simulationParameters

neuronSettings

public NeuronSettings neuronSettings

genesisSettings

public GenesisSettings genesisSettings

psicsSettings

public PsicsSettings psicsSettings

projProperties

public ProjectProperties projProperties

proj3Dproperties

public Display3DProperties proj3Dproperties

cellMechanismInfo

public CellMechanismInfo cellMechanismInfo

simPlotInfo

public SimPlotInfo simPlotInfo

elecInputInfo

public ElecInputInfo elecInputInfo

simConfigInfo

public SimConfigInfo simConfigInfo

cellManager

public CellManager cellManager
This will be fed with info on the cell morphologies in the projectMorphologies folder


generatedCellPositions

public GeneratedCellPositions generatedCellPositions
Holders for the generated cell positions info, etc.


generatedNetworkConnections

public GeneratedNetworkConnections generatedNetworkConnections

generatedElecInputs

public GeneratedElecInputs generatedElecInputs

generatedPlotSaves

public GeneratedPlotSaves generatedPlotSaves

neuronFileManager

public NeuronFileManager neuronFileManager
Generators of the main code for NEURON and GENESIS


genesisFileManager

public GenesisFileManager genesisFileManager

psicsFileManager

public PsicsFileManager psicsFileManager

pynnFileManager

public PynnFileManager pynnFileManager

neuromlFileManager

public NeuroMLFileManager neuromlFileManager
Generators of the scripts for NeuroML

Method Detail

createNewProject

public static Project createNewProject(String projectDir,
                                       String projectName,
                                       ProjectEventListener projectEventListner)
Gets a new empty project


getDummyProjectEventListener

public static ProjectEventListener getDummyProjectEventListener()
Only for testing purposes!!


loadProject

public static Project loadProject(File projectFile,
                                  ProjectEventListener projectEventListner)
                           throws ProjectFileParsingException
Gets the project object for a specified project file

Throws:
ProjectFileParsingException

markProjectAsEdited

public void markProjectAsEdited()

resetGenerated

public void resetGenerated()

checkAboutAA

public void checkAboutAA()

tableChanged

public void tableChanged(TableModelEvent e)
Specified by:
tableChanged in interface TableModelListener

getProjectStatusAsString

public String getProjectStatusAsString()

saveProject

public void saveProject()
                 throws NoProjectLoadedException
Might be a better place for this... public File saveNetworkStructureXML(File neuroMLFile, boolean zipped, boolean extraComments, String simConfig) throws NeuroMLException { try { Integer preferedUnits = (UnitConverter.GENESIS_PHYSIOLOGICAL_UNITS); StringBuffer notes = new StringBuffer("\nNetwork structure for project: " +getProjectName() + " saved with neuroConstruct v"+ GeneralProperties.getVersionNumber()+" on: "+ GeneralUtils.getCurrentTimeAsNiceString() +", " + GeneralUtils.getCurrentDateAsNiceString()+"\n\n"); Iterator cellGroups = generatedCellPositions.getNamesGeneratedCellGroups(); while (cellGroups.hasNext()) { String cg = cellGroups.next(); int numHere = generatedCellPositions.getNumberInCellGroup(cg); if (numHere>0) notes.append("Cell Group: "+cg+" contains "+numHere+" cells\n"); } notes.append("\n"); Iterator netConns = generatedNetworkConnections.getNamesNetConnsIter(); while (netConns.hasNext()) { String mc = netConns.next(); int numHere = generatedNetworkConnections.getSynapticConnections(mc).size(); if (numHere>0) notes.append("Network connection: "+mc+" contains "+numHere+" individual synaptic connections\n"); } notes.append("\n"); logger.logComment("Going to save network in NeuroML format in " + neuroMLFile.getAbsolutePath()); SimpleXMLDocument doc = new SimpleXMLDocument(); SimpleXMLElement rootElement = null; rootElement = new SimpleXMLElement(NetworkMLConstants.ROOT_ELEMENT); rootElement.addNamespace(new SimpleXMLNamespace("", NetworkMLConstants.NAMESPACE_URI)); rootElement.addNamespace(new SimpleXMLNamespace(MetadataConstants.PREFIX, MetadataConstants.NAMESPACE_URI)); rootElement.addNamespace(new SimpleXMLNamespace(NeuroMLConstants.XSI_PREFIX, NeuroMLConstants.XSI_URI)); rootElement.addAttribute(new SimpleXMLAttribute(NeuroMLConstants.XSI_SCHEMA_LOC, NetworkMLConstants.NAMESPACE_URI + " " + NetworkMLConstants.DEFAULT_SCHEMA_FILENAME)); rootElement.addAttribute(new SimpleXMLAttribute(MetadataConstants.LENGTH_UNITS, "micron")); doc.addRootElement(rootElement); logger.logComment(" **** Full XML: ****"); logger.logComment(" "); rootElement.addContent("\n\n"); rootElement.addChildElement(new SimpleXMLElement(MetadataConstants.PREFIX + ":" + MetadataConstants.NOTES_ELEMENT, "\n" + notes.toString())); SimpleXMLElement props = new SimpleXMLElement(MetadataConstants.PREFIX + ":" + MorphMLConstants.PROPS_ELEMENT); rootElement.addContent("\n\n"); rootElement.addChildElement(props); MetadataConstants.addProperty(props, NetworkMLConstants.NC_NETWORK_GEN_RAND_SEED, this.generatedCellPositions.getRandomSeed() + "", " "); if (simConfig!=null) { MetadataConstants.addProperty(props, NetworkMLConstants.NC_SIM_CONFIG, simConfig, " "); } rootElement.addContent("\n\n"); rootElement.addChildElement(this.generatedCellPositions.getNetworkMLElement()); rootElement.addContent("\n\n"); SimpleXMLEntity netEntity = this.generatedNetworkConnections.getNetworkMLElement(preferedUnits, extraComments); if (netEntity instanceof SimpleXMLElement) { rootElement.addChildElement((SimpleXMLElement)netEntity); } else if (netEntity instanceof SimpleXMLComment) { rootElement.addComment((SimpleXMLComment)netEntity); } rootElement.addContent("\n\n"); rootElement.addChildElement(this.generatedElecInputs.getNetworkMLElement(preferedUnits)); rootElement.addContent("\n\n"); String stringForm = doc.getXMLString("", false); logger.logComment(stringForm); if (!zipped) { FileWriter fw = new FileWriter(neuroMLFile); fw.write(stringForm); fw.close(); return neuroMLFile; } else { File zipFile = neuroMLFile; if (!neuroMLFile.getName().endsWith(ProjectStructure.getNeuroMLCompressedFileExtension())) zipFile = new File(neuroMLFile.getAbsolutePath() + ProjectStructure.getNeuroMLCompressedFileExtension()); String internalFilename = GeneralUtils.replaceAllTokens(zipFile.getName(), ProjectStructure.getNeuroMLCompressedFileExtension(), ProjectStructure.getNeuroMLFileExtension()); ZipUtils.zipStringAsFile(stringForm, zipFile, internalFilename, notes.toString()); return zipFile; } } catch (Exception ex) { logger.logError("Problem creating NeuroML file: " + neuroMLFile.getAbsolutePath(), ex); throw new NeuroMLException("Problem creating NeuroML file: " + neuroMLFile.getAbsolutePath(), ex); } }

Throws:
NoProjectLoadedException

getProjectStatus

public int getProjectStatus()

getProjectFileName

public String getProjectFileName()

getProjectFullFileName

public String getProjectFullFileName()
                              throws NoProjectLoadedException
Throws:
NoProjectLoadedException

getProjectFile

public File getProjectFile()

getProjectMainDirectory

public File getProjectMainDirectory()

getProjectDescription

public String getProjectDescription()

getProjectName

public String getProjectName()

toString

public String toString()
Overrides:
toString in class Object

setProjectName

public void setProjectName(String projectName)

getProjectFileVersion

public String getProjectFileVersion()

setProjectDescription

public void setProjectDescription(String projectDescription)
Put here so we can watch for changes


setProjectFileVersion

public void setProjectFileVersion(String pfv)

main

public static void main(String[] args)
                 throws ProjectFileParsingException
Throws:
ProjectFileParsingException