Class CreateAnnotationViaApiCommand
java.lang.Object
com.levigo.jadice.web.client.util.command.InjectedCommand
com.levigo.jadice.web.client.commands.AbstractContextCommand
com.levigo.jadice.web.client.commands.AbstractPageViewCommand
com.levigo.jadice.web.client.commands.CreateAnnotationViaApiCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
CreateMaskAnnoCommand
,CreateTextAnnoWithDefaultTextCommand
Creates an
Annotation
programmatically via Annotation API.
In contrast: The standard way is to create an Annotation
by user interaction on the UI.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Checks if the Command can be executed at the given time.abstract void
configure
(com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment aps, Annotation annotation) Fine-tunes the newly createdAnnotation
.protected Annotation
createAnnotation
(AnnotationProfile profile, String annoType, com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment aps) Creates anAnnotation
that is not yet attached to theDocument
structure.protected void
execute()
Executes the command to create anAnnotation
if the preconditions listed in the documentation ofcanExecute()
are met.abstract Page
Override this method to set the page onto which the newAnnotation
shall be placed.void
Loads anAnnotationProfile
which is required to create a newAnnotation
.void
setAnnotationType
(String annotationType) Sets theannotationType
.void
setProfileId
(String profileId) Sets theprofileId
.Methods inherited from class com.levigo.jadice.web.client.commands.AbstractPageViewCommand
getPageView, setPageView
Methods inherited from class com.levigo.jadice.web.client.commands.AbstractContextCommand
getContext, propagateContextChange, setContext
Methods inherited from class com.levigo.jadice.web.client.util.command.InjectedCommand
canExecute, clearInjections, execute, getKey, isSelected, isSelected, setKey
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.levigo.jadice.web.client.util.command.Command
getID, isAvailable, isAvailable
-
Constructor Details
-
CreateAnnotationViaApiCommand
public CreateAnnotationViaApiCommand()
-
-
Method Details
-
setProfileId
Sets theprofileId
.You must also call
loadAnnotationProfile()
;- Parameters:
profileId
- The profile ID as it is specified in the annotation profile XML file within the tagannotation-profile
.
-
setAnnotationType
Sets theannotationType
.- Parameters:
annotationType
- TheAnnotation
type as it is defined within either theannotation-type
orannotation-template
tag in the annotation profile file.
-
loadAnnotationProfile
public void loadAnnotationProfile()Loads anAnnotationProfile
which is required to create a newAnnotation
.After the
AnnotationProfile
is completely loaded, set the fieldprofile
. A non-null profile indicates that the command can now be executed. -
getPageForNewAnnotation
Override this method to set the page onto which the newAnnotation
shall be placed.- Returns:
- The page onto the
Annotation
shall be placed.
-
execute
protected void execute()Executes the command to create anAnnotation
if the preconditions listed in the documentation ofcanExecute()
are met. Additionally the following calls must have been made before calling execute:If you want to execute this Command without using a
JadiceButtonBuilder
, you need to call theInjectedCommand.execute(Collection)
method, providing the usedPageView
as single member of theCollection
param.- Specified by:
execute
in classInjectedCommand
-
canExecute
protected boolean canExecute()Checks if the Command can be executed at the given time.
Expected preconditions:- the connected
PageView
is created and a validDocument
is loaded. - the
Page
retrieved bygetPageForNewAnnotation()
is loaded and has a validServerConnection
object.
- a
PageSegment
is on thePage
on theDocumentLayer.DEFAULT
layer - the needed
profile
is a loaded and validAnnotationProfile
object.
- Overrides:
canExecute
in classAbstractPageViewCommand
- Returns:
- True if the Command can be executed.
- the connected
-