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.InstanceContent
instanceContent
private Instant
lastOpened
private org.openide.util.lookup.AbstractLookup
lookup
private ProjectInformationImpl
projectInformation
private ProjectMetaDataImpl
projectMetaData
private String
uniqueIdentifier
private AtomicInteger
workspaceIds
private WorkspaceProviderImpl
workspaceProvider
-
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 void
add(Object instance)
Adds an object to this project.protected void
close()
int
compareTo(ProjectImpl o)
boolean
equals(Object o)
WorkspaceImpl
getCurrentWorkspace()
Returns the current workspace.File
getFile()
Returns the file associated with this project.String
getFileName()
Returns the filename associated with this project.Instant
getLastOpened()
org.openide.util.Lookup
getLookup()
Gets any optional object from this project.String
getName()
Returns the name of the project.ProjectMetaData
getProjectMetadata()
Returns the project's metadata.String
getUniqueIdentifier()
Returns the project's unique identifier.Workspace
getWorkspace(int id)
Retrieve a workspace based on its unique identifier.int
getWorkspaceIds()
List<Workspace>
getWorkspaces()
Returns all the workspaces.boolean
hasCurrentWorkspace()
Returns true if the project has a current workspace.boolean
hasFile()
Returns true if the project is associated with a file.int
hashCode()
boolean
isClosed()
Returns true if the project is closed.boolean
isInvalid()
Returns true if the project is invalid.boolean
isOpen()
Returns true if the project is open.WorkspaceImpl
newWorkspace()
WorkspaceImpl
newWorkspace(int id)
int
nextWorkspaceId()
protected void
open()
void
remove(Object instance)
Removes an object to this project.void
setCurrentWorkspace(Workspace workspace)
protected void
setFile(File file)
protected void
setLastOpened()
protected void
setLastOpened(Instant lastOpened)
void
setWorkspaceIds(int ids)
String
toString()
-
-
-
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:Project
Adds an object to this project.
-
remove
public void remove(Object instance)
Description copied from interface:Project
Removes an object to this project.
-
getLookup
public org.openide.util.Lookup getLookup()
Description copied from interface:Project
Gets any optional object from this project.May contains:
ProjectMetaData
-
getCurrentWorkspace
public WorkspaceImpl getCurrentWorkspace()
Description copied from interface:Project
Returns the current workspace.- Specified by:
getCurrentWorkspace
in interfaceProject
- Returns:
- current workspace or
null
if no workspace is set.
-
hasCurrentWorkspace
public boolean hasCurrentWorkspace()
Description copied from interface:Project
Returns true if the project has a current workspace.- Specified by:
hasCurrentWorkspace
in 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:Project
Returns all the workspaces.Returns an empty collection if no workspaces.
- Specified by:
getWorkspaces
in interfaceProject
- Returns:
- a list of all workspaces, unmodifiable
-
getWorkspace
public Workspace getWorkspace(int id)
Description copied from interface:Project
Retrieve a workspace based on its unique identifier.- Specified by:
getWorkspace
in 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:Project
Returns true if the project is open.
-
isClosed
public boolean isClosed()
Description copied from interface:Project
Returns true if the project is closed.
-
isInvalid
public boolean isInvalid()
Description copied from interface:Project
Returns true if the project is invalid.
-
getName
public String getName()
Description copied from interface:Project
Returns 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:Project
Returns the project's unique identifier.This identifier is assigned at the project creation and is unique.
- Specified by:
getUniqueIdentifier
in interfaceProject
- Returns:
- the project's unique identifier
-
hasFile
public boolean hasFile()
Description copied from interface:Project
Returns 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:Project
Returns the filename associated with this project.Returns an empty string if the project isn't associated with a file.
- Specified by:
getFileName
in interfaceProject
- Returns:
- file name
- See Also:
Project.hasFile()
-
getFile
public File getFile()
Description copied from interface:Project
Returns the file associated with this project.Returns null if the project isn't associated with a file.
- Specified by:
getFile
in 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:Project
Returns the project's metadata.- Specified by:
getProjectMetadata
in interfaceProject
- Returns:
- project metadata
-
compareTo
public int compareTo(ProjectImpl o)
- Specified by:
compareTo
in interfaceComparable<ProjectImpl>
-
-