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 booleanChecks if the Command can be executed at the given time.abstract voidconfigure(com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment aps, Annotation annotation) Fine-tunes the newly createdAnnotation.protected AnnotationcreateAnnotation(AnnotationProfile profile, String annoType, com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment aps) Creates anAnnotationthat is not yet attached to theDocumentstructure.protected voidexecute()Executes the command to create anAnnotationif the preconditions listed in the documentation ofcanExecute()are met.abstract PageOverride this method to set the page onto which the newAnnotationshall be placed.voidLoads anAnnotationProfilewhich is required to create a newAnnotation.voidsetAnnotationType(String annotationType) Sets theannotationType.voidsetProfileId(String profileId) Sets theprofileId.Methods inherited from class com.levigo.jadice.web.client.commands.AbstractPageViewCommand
getPageView, setPageViewMethods inherited from class com.levigo.jadice.web.client.commands.AbstractContextCommand
getContext, propagateContextChange, setContextMethods inherited from class com.levigo.jadice.web.client.util.command.InjectedCommand
canExecute, clearInjections, execute, getKey, isSelected, isSelected, setKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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- TheAnnotationtype as it is defined within either theannotation-typeorannotation-templatetag in the annotation profile file.
-
loadAnnotationProfile
public void loadAnnotationProfile()Loads anAnnotationProfilewhich is required to create a newAnnotation.After the
AnnotationProfileis 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 newAnnotationshall be placed.- Returns:
- The page onto the
Annotationshall be placed.
-
execute
protected void execute()Executes the command to create anAnnotationif 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 usedPageViewas single member of theCollectionparam.- Specified by:
executein classInjectedCommand
-
canExecute
protected boolean canExecute()Checks if the Command can be executed at the given time.
Expected preconditions:- the connected
PageViewis created and a validDocumentis loaded. - the
Pageretrieved bygetPageForNewAnnotation()is loaded and has a validServerConnectionobject.
- a
PageSegmentis on thePageon theDocumentLayer.DEFAULTlayer - the needed
profileis a loaded and validAnnotationProfileobject.
- Overrides:
canExecutein classAbstractPageViewCommand- Returns:
- True if the Command can be executed.
- the connected
-