Package org.gephi.project.impl
Class ProjectImpl
- java.lang.Object
-
- org.gephi.project.impl.ProjectImpl
-
- All Implemented Interfaces:
Comparable<ProjectImpl>,Project,org.openide.util.Lookup.Provider
public class ProjectImpl extends Object implements Project, Comparable<ProjectImpl>, org.openide.util.Lookup.Provider
- Author:
- Mathieu Bastian
-
-
Field Summary
Fields Modifier and Type Field Description private org.openide.util.lookup.InstanceContentinstanceContentprivate InstantlastOpenedprivate org.openide.util.lookup.AbstractLookuplookupprivate ProjectInformationImplprojectInformationprivate ProjectMetaDataImplprojectMetaDataprivate StringuniqueIdentifierprivate AtomicIntegerworkspaceIdsprivate WorkspaceProviderImplworkspaceProvider
-
Constructor Summary
Constructors Constructor Description ProjectImpl(String name)ProjectImpl(String uniqueIdentifier, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Object instance)Adds an object to this project.protected voidclose()intcompareTo(ProjectImpl o)booleanequals(Object o)WorkspaceImplgetCurrentWorkspace()Returns the current workspace.FilegetFile()Returns the file associated with this project.StringgetFileName()Returns the filename associated with this project.InstantgetLastOpened()org.openide.util.LookupgetLookup()Gets any optional object from this project.StringgetName()Returns the name of the project.ProjectMetaDatagetProjectMetadata()Returns the project's metadata.StringgetUniqueIdentifier()Returns the project's unique identifier.WorkspacegetWorkspace(int id)Retrieve a workspace based on its unique identifier.intgetWorkspaceIds()List<Workspace>getWorkspaces()Returns all the workspaces.booleanhasCurrentWorkspace()Returns true if the project has a current workspace.booleanhasFile()Returns true if the project is associated with a file.inthashCode()booleanisClosed()Returns true if the project is closed.booleanisInvalid()Returns true if the project is invalid.booleanisOpen()Returns true if the project is open.WorkspaceImplnewWorkspace()WorkspaceImplnewWorkspace(int id)intnextWorkspaceId()protected voidopen()voidremove(Object instance)Removes an object to this project.voidsetCurrentWorkspace(Workspace workspace)protected voidsetFile(File file)protected voidsetLastOpened()protected voidsetLastOpened(Instant lastOpened)voidsetWorkspaceIds(int ids)StringtoString()
-
-
-
Field Detail
-
workspaceIds
private final AtomicInteger workspaceIds
-
instanceContent
private final transient org.openide.util.lookup.InstanceContent instanceContent
-
lookup
private final transient org.openide.util.lookup.AbstractLookup lookup
-
workspaceProvider
private final WorkspaceProviderImpl workspaceProvider
-
projectInformation
private final ProjectInformationImpl projectInformation
-
projectMetaData
private final ProjectMetaDataImpl projectMetaData
-
uniqueIdentifier
private final String uniqueIdentifier
-
lastOpened
private Instant lastOpened
-
-
Method Detail
-
add
public void add(Object instance)
Description copied from interface:ProjectAdds an object to this project.
-
remove
public void remove(Object instance)
Description copied from interface:ProjectRemoves an object to this project.
-
getLookup
public org.openide.util.Lookup getLookup()
Description copied from interface:ProjectGets any optional object from this project.May contains:
ProjectMetaData
-
getCurrentWorkspace
public WorkspaceImpl getCurrentWorkspace()
Description copied from interface:ProjectReturns the current workspace.- Specified by:
getCurrentWorkspacein interfaceProject- Returns:
- current workspace or
nullif no workspace is set.
-
hasCurrentWorkspace
public boolean hasCurrentWorkspace()
Description copied from interface:ProjectReturns true if the project has a current workspace.- Specified by:
hasCurrentWorkspacein interfaceProject- Returns:
- true if it has a current workspace, false otherwise
-
getLastOpened
public Instant getLastOpened()
-
setCurrentWorkspace
public void setCurrentWorkspace(Workspace workspace)
-
newWorkspace
public WorkspaceImpl newWorkspace()
-
newWorkspace
public WorkspaceImpl newWorkspace(int id)
-
getWorkspaces
public List<Workspace> getWorkspaces()
Description copied from interface:ProjectReturns all the workspaces.Returns an empty collection if no workspaces.
- Specified by:
getWorkspacesin interfaceProject- Returns:
- a list of all workspaces, unmodifiable
-
getWorkspace
public Workspace getWorkspace(int id)
Description copied from interface:ProjectRetrieve a workspace based on its unique identifier.- Specified by:
getWorkspacein interfaceProject- Parameters:
id- workspace's unique identifier- Returns:
- found workspace or null if not found
-
setLastOpened
protected void setLastOpened()
-
setLastOpened
protected void setLastOpened(Instant lastOpened)
-
open
protected void open()
-
close
protected void close()
-
isOpen
public boolean isOpen()
Description copied from interface:ProjectReturns true if the project is open.
-
isClosed
public boolean isClosed()
Description copied from interface:ProjectReturns true if the project is closed.
-
isInvalid
public boolean isInvalid()
Description copied from interface:ProjectReturns true if the project is invalid.
-
getName
public String getName()
Description copied from interface:ProjectReturns the name of the project.The name can't be null and has a default value (e.g. Project 1).
-
getUniqueIdentifier
public String getUniqueIdentifier()
Description copied from interface:ProjectReturns the project's unique identifier.This identifier is assigned at the project creation and is unique.
- Specified by:
getUniqueIdentifierin interfaceProject- Returns:
- the project's unique identifier
-
hasFile
public boolean hasFile()
Description copied from interface:ProjectReturns true if the project is associated with a file.A project is associated with a file if it has been saved/loaded to/from a file.
-
getFileName
public String getFileName()
Description copied from interface:ProjectReturns the filename associated with this project.Returns an empty string if the project isn't associated with a file.
- Specified by:
getFileNamein interfaceProject- Returns:
- file name
- See Also:
Project.hasFile()
-
getFile
public File getFile()
Description copied from interface:ProjectReturns the file associated with this project.Returns null if the project isn't associated with a file.
- Specified by:
getFilein interfaceProject- Returns:
- file or null if none
- See Also:
Project.hasFile()
-
setFile
protected void setFile(File file)
-
nextWorkspaceId
public int nextWorkspaceId()
-
getWorkspaceIds
public int getWorkspaceIds()
-
setWorkspaceIds
public void setWorkspaceIds(int ids)
-
getProjectMetadata
public ProjectMetaData getProjectMetadata()
Description copied from interface:ProjectReturns the project's metadata.- Specified by:
getProjectMetadatain interfaceProject- Returns:
- project metadata
-
compareTo
public int compareTo(ProjectImpl o)
- Specified by:
compareToin interfaceComparable<ProjectImpl>
-
-