public class DesignerContextImpl.DesignerProjectHolderImpl extends DefaultProjectHolder implements DesignerProjectContext
listeners, project
Constructor and Description |
---|
DesignerProjectHolderImpl(Project project,
ProjectScope scope) |
Modifier and Type | Method and Description |
---|---|
java.util.UUID |
addFolder(long newResourceId,
java.lang.String moduleId,
int scope,
java.lang.String folderName,
java.util.UUID parent)
Adds a new folder under the given parent.
|
boolean |
canEditResourceProtection()
Checks whether or not the current logged in user can edit the protection bits of project resources.
|
void |
deleteResource(long resourceId)
Removes the resource from the current project
|
protected void |
fireResourceModified(ProjectResource resource,
ProjectChangeListener.ResourceModification mod) |
int |
getClientScopedUnsavedChangeCount()
Counts the number of open or updated locks this designer owns for client scoped resources.
|
protected DesignerContextImpl.LockInfo |
getLockInfo(long resourceId) |
protected java.util.Map<java.lang.Long,DesignerContextImpl.LockInfo> |
getResourceLocks() |
ProjectScope |
getScope() |
int |
getUnsavedChangeCount()
Counts the number of open or updated locks this designer owns.
|
protected boolean |
giveResourceProtectionOption(ProjectResource resource)
This method shows a dialog that allows the user to changed the protection status of the resource
or do nothing, or write once.
|
boolean |
hasLock(long resourceId)
Checks to see if the given lock is currently held, which means either:
it has been obtained but not released (it is open)
It has been obtained, modified, and then released, but a save operation has not occurred.
|
boolean |
isLockModified(long resourceId)
Returns true if the lock has been obtained and updated
|
boolean |
isLockOpen(long resourceId)
Returns true if the lock has been obtained and not released
|
boolean |
isResourceProtected(long resourceId,
boolean quiet) |
protected void |
lockLog(java.lang.String action,
long lock) |
void |
moveResource(long resourceId,
java.util.UUID newParent)
Moves the resource to a new parent.
|
long |
newResourceId()
Creates and obtains the lock for a new resource id
|
void |
releaseAllLocks() |
void |
releaseLock(long resourceId)
Designer elements should call this function when they are done with the resource that they
obtained a lock for.
|
boolean |
requestLock(long resourceId)
Requests the lock for the given resource.
|
boolean |
requestLockQuietly(long resourceId)
Just like requestLock, except that if the lock isn't obtained, no error message is displayed.
|
protected boolean |
resourceExists(long resourceId) |
void |
saveFinished(Project diff)
After the project is saved, the Gateway returns a diff which includes the changes other designers made.
|
void |
structuredRename(long resourceId,
java.lang.String newName)
Attempts to rename the given project resource, respecting the requirement that the name be unique amongst
siblings
(with respect to the folder structure)
|
void |
synchLocks()
Attempts to re-obtain all locks that this resource lock manager currently has.
|
void |
update(Project diff,
boolean dirty) |
boolean |
updateLock(long resourceId)
Designer elements should call this function when they have actually updated the resource with the given ID.
|
void |
updateResource(long id,
byte[] data)
Convenience call that updates only the serialized bytes of a project resource, leaving all other parameters
intact.
|
void |
updateResource(ProjectResource resource)
Adds or updates the given project resource
|
addProjectChangeListener, applyDiff, fireProjectChanged, getProject, removeProjectChangeListener, setProject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProjectChangeListener, applyDiff, getProject, removeProjectChangeListener
public DesignerProjectHolderImpl(Project project, ProjectScope scope)
public ProjectScope getScope()
getScope
in interface DesignerProjectContext
public long newResourceId() throws java.lang.Exception
ResourceLockManager
newResourceId
in interface ResourceLockManager
java.lang.Exception
public int getUnsavedChangeCount()
public int getClientScopedUnsavedChangeCount()
protected java.util.Map<java.lang.Long,DesignerContextImpl.LockInfo> getResourceLocks()
public boolean updateLock(long resourceId)
ResourceLockManager
updateLock
in interface ResourceLockManager
protected void lockLog(java.lang.String action, long lock)
protected DesignerContextImpl.LockInfo getLockInfo(long resourceId)
public boolean hasLock(long resourceId)
ResourceLockManager
hasLock
in interface ResourceLockManager
public boolean isLockModified(long resourceId)
ResourceLockManager
isLockModified
in interface ResourceLockManager
public boolean isLockOpen(long resourceId)
ResourceLockManager
isLockOpen
in interface ResourceLockManager
public void releaseLock(long resourceId)
releaseLock
in interface ResourceLockManager
resourceId
- public void synchLocks()
ResourceLockManager
synchLocks
in interface ResourceLockManager
public void releaseAllLocks()
public boolean requestLock(long resourceId)
requestLock
in interface ResourceLockManager
resourceId
- public boolean requestLockQuietly(long resourceId)
ResourceLockManager
requestLockQuietly
in interface ResourceLockManager
public boolean canEditResourceProtection() throws GatewayException
DesignerProjectContext
canEditResourceProtection
in interface DesignerProjectContext
GatewayException
protected boolean resourceExists(long resourceId)
protected boolean giveResourceProtectionOption(ProjectResource resource)
public void saveFinished(Project diff)
public void update(Project diff, boolean dirty)
protected void fireResourceModified(ProjectResource resource, ProjectChangeListener.ResourceModification mod)
public void updateResource(long id, byte[] data)
DesignerProjectContext
updateResource
in interface DesignerProjectContext
public boolean isResourceProtected(long resourceId, boolean quiet)
public void updateResource(ProjectResource resource)
DesignerProjectContext
updateResource
in interface DesignerProjectContext
public void deleteResource(long resourceId)
DesignerProjectContext
deleteResource
in interface DesignerProjectContext
public void structuredRename(long resourceId, java.lang.String newName) throws java.lang.IllegalArgumentException
DesignerProjectContext
structuredRename
in interface DesignerProjectContext
resourceId
- The ID of the resource to renamenewName
- The new namejava.lang.IllegalArgumentException
- Thrown when the name is not unique.public void moveResource(long resourceId, java.util.UUID newParent)
DesignerProjectContext
moveResource
in interface DesignerProjectContext
public java.util.UUID addFolder(long newResourceId, java.lang.String moduleId, int scope, java.lang.String folderName, java.util.UUID parent)
DesignerProjectContext
addFolder
in interface DesignerProjectContext