Class DefaultProject

java.lang.Object
org.gvsig.app.project.DefaultProject
All Implemented Interfaces:
PropertyChangeListener, Serializable, Iterable<Document>, EventListener, DocumentsContainer, Project, org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport, org.gvsig.tools.observer.Observable, org.gvsig.tools.persistence.Persistent, org.gvsig.tools.util.PropertiesSupport

public class DefaultProject extends Object implements Serializable, PropertyChangeListener, Project
Clase que representa un proyecto de gvSIG
See Also:
  • Field Details

    • VERSION

      public static String VERSION
  • Method Details

    • clean

      protected void clean()
    • getPreferences

      public static ProjectPreferences getPreferences()
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener arg0)
      Specified by:
      addPropertyChangeListener in interface Project
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Specified by:
      removePropertyChangeListener in interface Project
    • getCreationDate

      public String getCreationDate()
      Return the creation date of the project
      Specified by:
      getCreationDate in interface Project
      Returns:
    • setCreationDate

      protected void setCreationDate(String creationDate)
    • createDocument

      public Document createDocument(String type)
      Specified by:
      createDocument in interface DocumentsContainer
    • getName

      public String getName()
      Return the name of the project
      Specified by:
      getName in interface Project
      Returns:
    • setName

      public void setName(String name)
      Set the name of he project.
      Specified by:
      setName in interface Project
      Parameters:
      name -
      string -
    • getComments

      public String getComments()
      Return the comments associateds with the project
      Specified by:
      getComments in interface Project
      Returns:
      comments
    • setComments

      public void setComments(String string)
      Set the comments associateds with the project
      Specified by:
      setComments in interface Project
      Parameters:
      string - as string
      comments - as string
    • getModificationDate

      public String getModificationDate()
      Retuen the modification date of the project.
      Specified by:
      getModificationDate in interface Project
      Returns:
      modification date as string
    • setModificationDate

      protected void setModificationDate(String string)
    • getOwner

      public String getOwner()
      Return the author of the project,
      Specified by:
      getOwner in interface Project
      Returns:
      author as string
    • setOwner

      public void setOwner(String owner)
      Sets the author of the project
      Specified by:
      setOwner in interface Project
      Parameters:
      owner -
      author - name as string
    • getSelectionColor

      public Color getSelectionColor()
      Obtiene el color de selecci�n que se usar� en el proyecto
      Specified by:
      getSelectionColor in interface Project
      Returns:
    • setSelectionColor

      public void setSelectionColor(String selectionColor)
      Sets the selecction color
      Specified by:
      setSelectionColor in interface Project
      Parameters:
      selectionColor -
      selection - color as string
    • setSelectionColor

      public void setSelectionColor(Color selectionColor)
      Sets the selecction color
      Specified by:
      setSelectionColor in interface Project
      Parameters:
      selectionColor -
      selection - color as Color
    • getProjection

      public org.gvsig.crs.projection.lib.Projection getProjection()
      Specified by:
      getProjection in interface Project
    • setProjection

      public void setProjection(org.gvsig.crs.projection.lib.Projection projection)
      Specified by:
      setProjection in interface Project
    • setModified

      public void setModified(boolean modified)
      Sets the modified state of project. Can't set to not modified.
      Specified by:
      setModified in interface Project
      Parameters:
      modified - as boolean
    • hasChanged

      public boolean hasChanged()
      Specified by:
      hasChanged in interface Project
    • getDocuments

      public List<Document> getDocuments()
      Return a list of documents in the project.
      Specified by:
      getDocuments in interface DocumentsContainer
      Returns:
      documents as List of IProjectDocument
    • getDocuments

      public List<Document> getDocuments(String type)
      Return a list with all documents of especified type.
      Specified by:
      getDocuments in interface DocumentsContainer
      Parameters:
      type - of document
      Returns:
      List of IProjectDocument
    • getDocuments

      public List<Document> getDocuments(Class<? extends Document> documentClass)
      Description copied from interface: DocumentsContainer
      Utility method that call getDocuments(Predicatefilter).
      Specified by:
      getDocuments in interface DocumentsContainer
      Parameters:
      documentClass - of the documents that should return.
      Returns:
      List of project documents of this document class.
    • getDocuments

      public List<Document> getDocuments(Predicate<Document> filter)
      Description copied from interface: DocumentsContainer
      Return a list of all the documents of the project that meet the specified filter.The list of documents will be ordered alphabetically by the name of the document. If filter is null return all documents.
      Specified by:
      getDocuments in interface DocumentsContainer
      Parameters:
      filter - that determines what documents should be returned.
      Returns:
      List of project document that meet the filter.
    • add

      public void add(Document document)
      Adds a document to the project
      Specified by:
      add in interface Project
      Parameters:
      document - as Document
    • addDocument

      public void addDocument(Document document)
      Description copied from interface: DocumentsContainer
      Adds a document to the project
      Specified by:
      addDocument in interface DocumentsContainer
      Parameters:
      document - as Document
    • remove

      public void remove(Document doc)
      Description copied from interface: Project
      Remove a document of the project
      Specified by:
      remove in interface Project
      Parameters:
      doc - as Document
    • removeDocument

      public void removeDocument(Document doc)
      Description copied from interface: DocumentsContainer
      Remove a document of the project
      Specified by:
      removeDocument in interface DocumentsContainer
      Parameters:
      doc - as Document
    • iterator

      public Iterator<Document> iterator()
      Specified by:
      iterator in interface DocumentsContainer
      Specified by:
      iterator in interface Iterable<Document>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface DocumentsContainer
    • getViewName

      public String getViewName(org.gvsig.fmap.mapcontext.layers.FLayer layer)
      Return the view that contains the especified layer.
      Specified by:
      getViewName in interface Project
      Parameters:
      layer -
      Returns:
      name of the view that contains the layer
      Throws:
      RuntimeException - Si la capa que se pasa como par�metro no se encuentra en ninguna vista
    • addExtent

      public void addExtent(ProjectExtent arg1)
      Specified by:
      addExtent in interface Project
    • removeExtent

      public ProjectExtent removeExtent(int arg0)
      Specified by:
      removeExtent in interface Project
    • getExtents

      public ProjectExtent[] getExtents()
      Specified by:
      getExtents in interface Project
    • getDocument

      public Document getDocument(String name, String type)
      Obtiene un documento a partir de su nombre y el nombre de registro en el pointExtension, este �ltimo se puede obtener del Project****Factory.registerName.
      Specified by:
      getDocument in interface DocumentsContainer
      Parameters:
      name - Nombre del documento
      type - nombre de registro en el extensionPoint
      Returns:
      Documento
    • getDocument

      public Document getDocument(Predicate<Document> condition)
      Description copied from interface: DocumentsContainer
      Returns the first document that fit the condition specified. If documnt don't exists return null
      Specified by:
      getDocument in interface DocumentsContainer
      Parameters:
      condition -
      Returns:
      Document that fit the condition specified.
    • getDocument

      public Document getDocument(String name)
      Description copied from interface: DocumentsContainer
      Returns the document with the name specified by name. If documnt don't exists return null
      Specified by:
      getDocument in interface DocumentsContainer
      Parameters:
      name -
      Returns:
      Document with the name specified by name
    • getUniqueNameForDocument

      public String getUniqueNameForDocument(String type, String name)
    • saveState

      public void saveState(File out) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveState in interface Project
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • getFile

      public File getFile()
      Specified by:
      getFile in interface Project
    • saveState

      @Deprecated public void saveState(OutputStream out) throws org.gvsig.tools.persistence.exception.PersistenceException
      Deprecated.
      Specified by:
      saveState in interface Project
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • saveState

      public void saveState(File file, BufferedImage preview)
      Specified by:
      saveState in interface Project
    • saveState

      public void saveState(OutputStream out, File rootFolder) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveState in interface Project
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • createProjectCopy

      public File createProjectCopy(boolean error)
    • loadState

      @Deprecated public void loadState(InputStream in)
      Deprecated.
      Specified by:
      loadState in interface Project
    • loadState

      public void loadState(InputStream in, File rootFolder)
    • getUnloadedObjects

      public Set<String> getUnloadedObjects()
      Specified by:
      getUnloadedObjects in interface Project
    • getLoadErrors

      public List<Exception> getLoadErrors()
      Specified by:
      getLoadErrors in interface Project
    • loadState

      public void loadState(File in)
      Specified by:
      loadState in interface Project
    • loadFromState

      public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      loadFromState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • saveToState

      public void saveToState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveToState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • getProperty

      @Deprecated public Object getProperty(Object key)
      Deprecated.
      Specified by:
      getProperty in interface org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport
    • setProperty

      @Deprecated public void setProperty(Object key, Object obj)
      Deprecated.
      Specified by:
      setProperty in interface org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport
    • getExtendedProperties

      @Deprecated public Map getExtendedProperties()
      Deprecated.
      Specified by:
      getExtendedProperties in interface org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport
    • getProperty

      public Object getProperty(String name)
      Specified by:
      getProperty in interface org.gvsig.tools.util.PropertiesSupport
    • setProperty

      public void setProperty(String name, Object value)
      Specified by:
      setProperty in interface org.gvsig.tools.util.PropertiesSupport
    • getProperties

      public Map<String,Object> getProperties()
      Specified by:
      getProperties in interface org.gvsig.tools.util.PropertiesSupport
    • registerPersistent

      public static void registerPersistent()
    • setDefaultSelectionColor

      public static void setDefaultSelectionColor(Color color)
    • getDefaultSelectionColor

      public static Color getDefaultSelectionColor()
    • getDefaultMapUnits

      public static int getDefaultMapUnits()
    • getDefaultDistanceUnits

      public static int getDefaultDistanceUnits()
    • getDefaultDistanceArea

      public static int getDefaultDistanceArea()
    • setDefaultMapUnits

      public static void setDefaultMapUnits(int mapUnits)
    • setDefaultDistanceUnits

      public static void setDefaultDistanceUnits(int distanceUnits)
    • setDefaultDistanceArea

      public static void setDefaultDistanceArea(int distanceArea)
    • setDefaultProjection

      public static void setDefaultProjection(org.gvsig.crs.projection.lib.Projection defaultProjection)
    • getDefaultProjection

      public static org.gvsig.crs.projection.lib.Projection getDefaultProjection()
    • setColor

      public void setColor(String color)
    • getColor

      public String getColor()
      Return the selection color
      Returns:
      selection color as string
    • getViews

      public List<Document> getViews()
      Return the list of views of the project
      Returns:
      views as ArrayList of ProjectDocument
    • addView

      public void addView(DefaultViewDocument v)
      Add a view to the project
    • delView

      public void delView(int i)
      Remove a view of the project
      Parameters:
      index - of the view as integer
    • getProjectDocumentByName

      public Document getProjectDocumentByName(String name, String type)
    • getDocumentsByType

      public List<Document> getDocumentsByType(String type)
    • exportToXML

      public String exportToXML(AbstractDocument[] selectedItems) throws SaveException
      Throws:
      SaveException
    • importFromXML

      public void importFromXML(String sourceString, String docType)
    • isValidXMLForImport

      public boolean isValidXMLForImport(String sourceString, String docType)
    • canImportDocuments

      public boolean canImportDocuments(String data, String doctype)
      Specified by:
      canImportDocuments in interface Project
    • exportDocumentsAsText

      public String exportDocumentsAsText(List<Document> documents)
      Specified by:
      exportDocumentsAsText in interface Project
    • importDocuments

      public void importDocuments(String data, String doctype)
      Specified by:
      importDocuments in interface Project
    • getActiveDocument

      public Document getActiveDocument()
      Specified by:
      getActiveDocument in interface DocumentsContainer
    • getActiveDocument

      public Document getActiveDocument(String documentTypeName)
      Specified by:
      getActiveDocument in interface DocumentsContainer
    • getOpenDocuments

      public List<Document> getOpenDocuments(Class<? extends Document> documentClass)
      Description copied from interface: DocumentsContainer
      Utility method that call getOpenDocuments(Predicatefilter).
      Specified by:
      getOpenDocuments in interface DocumentsContainer
      Parameters:
      documentClass - of the documents that should return.
      Returns:
      List of project document of this document class.
    • getOpenDocuments

      public List<Document> getOpenDocuments(String type)
      Description copied from interface: DocumentsContainer
      Utility method that call getOpenDocuments(Predicatefilter).
      Specified by:
      getOpenDocuments in interface DocumentsContainer
      Parameters:
      type - of the documents that should return.
      Returns:
      List of project document of this document class.
    • getOpenDocuments

      public List<Document> getOpenDocuments(Predicate<Document> filter)
      Description copied from interface: DocumentsContainer
      Return a list of all open documents of the project that meet the specified filter.The document list follows the same order as the windows of these, being the first in case of complying with the filter, the corresponding to the active window.
      Specified by:
      getOpenDocuments in interface DocumentsContainer
      Parameters:
      filter - that determines what documents should be returned.
      Returns:
      List of project document that meet the filter.
    • getActiveDocument

      public Document getActiveDocument(Class<? extends Document> documentClass)
      Specified by:
      getActiveDocument in interface DocumentsContainer
    • getFirstDocument

      public Document getFirstDocument(Class<? extends Document> documentClass)
      Specified by:
      getFirstDocument in interface DocumentsContainer
    • getActiveWindow

      public org.gvsig.andami.ui.mdiManager.IWindow getActiveWindow(Class<? extends Document> documentClass)
      Specified by:
      getActiveWindow in interface DocumentsContainer
    • addObserver

      public void addObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      addObserver in interface org.gvsig.tools.observer.Observable
    • deleteObserver

      public void deleteObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      deleteObserver in interface org.gvsig.tools.observer.Observable
    • deleteObservers

      public void deleteObservers()
      Specified by:
      deleteObservers in interface org.gvsig.tools.observer.Observable