Module platform

Class Project

java.lang.Object
de.grogra.pf.ui.Project
All Implemented Interfaces:
RegistryContext
Direct Known Subclasses:
ProjectImpl

public abstract class Project extends Object implements RegistryContext
The abstract Project class holds all information regarding the Project, such as the registry, the file and mimeType and the name of the project This class also holds all functions for any file interaction with the project. Not to be confused with projectGraph hosted in the registry (which is a GraphManager).
Author:
Tim Oberländer
  • Field Details

  • Constructor Details

    • Project

      public Project(Registry registry)
  • Method Details

    • init

      public void init()
    • dispose

      public abstract void dispose()
    • getId

      public Object getId()
    • setId

      public void setId(Object id)
    • loadProjectFile

      public void loadProjectFile(FilterSource fs, Map initParams, Context context)
    • setName

      public void setName(String name)
      defines the name in the local variable as well as in the registry
      Parameters:
      name -
    • getName

      public String getName()
    • getMimeType

      public MimeType getMimeType()
    • setMimeType

      public void setMimeType(MimeType mimeType)
    • getRegistry

      public Registry getRegistry()
      Description copied from interface: RegistryContext
      Returns the Registry which is linked with this instance.
      Specified by:
      getRegistry in interface RegistryContext
      Returns:
      the registry linked with this instance
    • getFile

      public File getFile()
    • setFile

      public void setFile(File file)
    • setFile

      public void setFile(File file, MimeType mimeType)
      Checks if the file and the mimetype is not null and if GroIMP is able to write to this file Type The defined file is only used to save changes to the same location from which the file was opened
      Parameters:
      file -
      mimeType -
    • save

      public boolean save()
      saves Project to the location from which it was opened
      Returns:
    • saveAs

      public boolean saveAs(File file, MimeType mimeType)
      Saves file to given location
      Parameters:
      file -
      mimeType -
      Returns:
    • save

      public boolean save(Object object, File f, MimeType mt)
      Save Object (normally the Registry) to a given location Maybe obsolete in this design since the object should always be the Registry
      Parameters:
      object -
      f -
      mt -
      Returns:
    • addNode

      public void addNode(Node node, Context context)
      To add a node the used workbench must be added as a parameter to provide a context that contains a JobManager
      Parameters:
      node -
      context -
    • removeFile

      public void removeFile(SourceFile sf, Context context)
    • removeNode

      public void removeNode(Node node, Context context)
    • renameItem

      public void renameItem(Item node, String newName, Context context)
      Rename a given Item using the JobManager of the given context
      Parameters:
      node -
      newName -
      context -
    • renameFile

      public void renameFile(SourceFile file, String newName, Context context)
    • addSourceFile

      public SourceFile addSourceFile(String fileName, MimeType mt, InputStream ins, Object des)
      To add a SourceFile from a stream an empty file is created and the stream is written in it
      Parameters:
      fileName -
      mt -
      ins -
      dest -
      Returns:
    • setSourceFileContent

      public void setSourceFileContent(String fileName, InputStream ins) throws IOException
      Throws:
      IOException
    • setSourceFileContent

      public void setSourceFileContent(SourceFile file, InputStream ins) throws IOException
      Throws:
      IOException
    • addSourceFile

      public SourceFile addSourceFile(File file, MimeType mt)
      Add a new SourceFile to the Project
      Parameters:
      file -
      mt -
      Returns:
    • addSourceFile

      public SourceFile addSourceFile(File file, MimeType mt, Object dest)
      Add a new sourceFile to the project at a specific destination If no destination is null the file is added to the default location
      Parameters:
      file -
      mt -
      dest -
      Returns:
    • toSourceFile

      public SourceFile toSourceFile(File file, MimeType mt, Object dest)
      create a sourceFile form a file
      Parameters:
      file -
      mt -
      dest -
      Returns:
    • logInfo

      protected void logInfo(String msg, Throwable e)
    • logInfo

      protected void logInfo(String msg)
    • getLogFilter

      public Filter getLogFilter()
    • getPendingLogs

      public ObjectList getPendingLogs()
    • setLogFilter

      public void setLogFilter(Filter newFilter)
    • setPendingLogs

      public void setPendingLogs(ObjectList newList)
    • initialize

      public abstract void initialize(JobManager jm)
    • updateName

      protected abstract void updateName()
    • listFunctions

      public abstract Command[] listFunctions()
    • execute

      public abstract void execute(String command, Context ctx)
    • execute

      public abstract void execute(Command command, Context ctx)
    • compile

      public abstract void compile(Context context, Command afterCommand)
    • getState

      protected abstract void getState(Item s)
    • stopLocalFileSynchronization

      public abstract void stopLocalFileSynchronization()
    • startLocalFileSynchronization

      public abstract void startLocalFileSynchronization()
    • initLogger

      protected abstract void initLogger()