ca.sqlpower.architect.swingui
Class SwingUIProject

java.lang.Object
  extended by ca.sqlpower.architect.CoreProject
      extended by ca.sqlpower.architect.swingui.SwingUIProject

public class SwingUIProject
extends CoreProject

The SwingUIProject class is responsible for saving and loading projects. It is capable of writing itself to an output stream, and reading in a previously-written stream to re-create a previous instance of a project at a later date. Such "project files" are meant to be highly portable, and should remain backward compatible now that the product has been released.

Anyone who makes a change to the file reading code which causes a failure to read older (release 1.0.19 or later) project files will get Airzooka'ed.


Field Summary
protected  java.util.Map<java.lang.String,OLAPPane<?,?>> olapPaneLoadIdMap
          This map maps String ID codes to OLAPPane instances used in loading.
 
Fields inherited from class ca.sqlpower.architect.CoreProject
dbcsLoadIdMap, dbcsSaveIdMap, file, modified, olapObjectLoadIdMap, olapObjectSaveIdMap, out, progress, saveInProgress, session, sqlObjectLoadIdMap, sqlObjectSaveIdMap
 
Constructor Summary
SwingUIProject(ArchitectSwingSession session)
          Sets up a new project file load/save object for the given session.
 
Method Summary
protected  ArchitectSwingSession getSession()
           
 boolean isModified()
          Override that also considers whether each OLAP edit session has modifications.
 void load(java.io.InputStream in, ca.sqlpower.sql.DataSourceCollection dataSources)
          Loads the project data from the given input stream.
 void save(java.io.OutputStream out, java.lang.String encoding)
           
 void save(java.io.PrintWriter out, java.lang.String encoding)
          Do just the writing part of save, given a PrintWriter
 void save(javax.swing.ProgressMonitor pm)
          Saves this project by writing an XML description of it to a temp file, then renaming.
protected  org.apache.commons.digester.Digester setupDigester()
           
 
Methods inherited from class ca.sqlpower.architect.CoreProject
addAllTablesFrom, getFile, isSaveInProgress, setFile, setModified, setSaveInProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

olapPaneLoadIdMap

protected java.util.Map<java.lang.String,OLAPPane<?,?>> olapPaneLoadIdMap
This map maps String ID codes to OLAPPane instances used in loading.

Constructor Detail

SwingUIProject

public SwingUIProject(ArchitectSwingSession session)
               throws ArchitectException
Sets up a new project file load/save object for the given session.

Parameters:
session - the session that this instance will be responsible for loading into and saving out from.
Throws:
java.lang.NullPointerException - if the given session is null
ArchitectException
Method Detail

isModified

public boolean isModified()
Override that also considers whether each OLAP edit session has modifications.

Overrides:
isModified in class CoreProject

load

public void load(java.io.InputStream in,
                 ca.sqlpower.sql.DataSourceCollection dataSources)
          throws java.io.IOException,
                 ArchitectException
Description copied from class: CoreProject
Loads the project data from the given input stream.

Note: the input stream is always closed afterwards.

Overrides:
load in class CoreProject
Parameters:
in - Used to load in the project data, must support mark.
dataSources - Collection of the data sources used in the project
Throws:
java.io.IOException
ArchitectException

setupDigester

protected org.apache.commons.digester.Digester setupDigester()
                                                      throws javax.xml.parsers.ParserConfigurationException,
                                                             org.xml.sax.SAXException
Overrides:
setupDigester in class CoreProject
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

save

public void save(javax.swing.ProgressMonitor pm)
          throws java.io.IOException,
                 ArchitectException
Saves this project by writing an XML description of it to a temp file, then renaming. The location of the file is determined by this project's file property.

Parameters:
pm - An optional progress monitor which will be initialised then updated periodically during the save operation. If you use a progress monitor, don't invoke this method on the AWT event dispatch thread!
Throws:
java.io.IOException
ArchitectException

save

public void save(java.io.PrintWriter out,
                 java.lang.String encoding)
          throws java.io.IOException,
                 ArchitectException
Do just the writing part of save, given a PrintWriter

Parameters:
out - - the file to write to
Throws:
java.io.IOException
ArchitectException

save

public void save(java.io.OutputStream out,
                 java.lang.String encoding)
          throws java.io.IOException,
                 ArchitectException
Throws:
java.io.IOException
ArchitectException

getSession

protected ArchitectSwingSession getSession()
Overrides:
getSession in class CoreProject


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca