3.11.1.1.1. ARenderJSAPI

public class ARenderJSAPI implements Exportable

ARender Javascript API Base export class

Author:Francois Barre

3.11.1.1.1.1. Constructors

protected ARenderJSAPI(ARenderEventBus eventBus, ARenderJSAPIConfiguration config)

3.11.1.1.1.2. Methods

public void askChangeDocument(String type, String documentId)

Ask for a document change

Parameters:
  • type – the type of change, can be one of ‘Previous’, ‘Next’, ‘First’, ‘Last’ or ‘ByDocumentId’
  • documentId – the document Id, only available if type is set to ‘ByDocumentId’
Throws:
public void askChangePage(String type, int offset, PageRelativePosition position)

Ask for a page change

Parameters:
  • type – the type of change, can be one of NoChange,Relative,Index,Absolute com.arondor.viewer.client.enums.PageChangeType
  • offset – the offset of the change, depending on the value of type
  • position – in-page absolute position
public void askDownloadDocument(String documentId, String documentTitle, String suffix)
public void cancellableLoadDocument(String url, DocumentLoadHandler documentLoadHandler, NotifyLoadingErrorHandler notifyLoadingErrorHandler)

cancellableLoadDocument

Parameters:
  • url – the unique identifier for the document to open
  • documentLoadHandler – the hook when document loading succeeded
  • notifyLoadingErrorHandler – the hook when document loading fails
public void changeConfigurableElement(String name, boolean enabled)
public void clearPluginEvent(String pluginName)
public void closeDocument()

Close current document

public void closeErrorPopup()

Close potential error popups remaining on ARender Window

public void closePlugin(String pluginName)
public void disableExternalPDFDocumentHyperlinks(DocumentId documentId)

Disable external hyperlinks from a document

Parameters:
  • documentId – the documentId onto which externalHyperlinks should be disabled
public void disableInternalPDFDocumentHyperlinks(DocumentId documentId)

Disable internal hyperlinks from a document

Parameters:
  • documentId – the documentId onto which internalHyperlinks should be disabled
public void disallowClickOnHyperlinks(boolean disallow)

Ask ARender to disallow the click on document hyperlinks for the current document

Parameters:
  • disallow – is true when hyperlinks are to be disallowed to be clicked
public void displayComment(String documentId, String display)

Display annotation comment from a document

Parameters:
  • documentId – The documentId of the annotation comment to display
  • display – The type of display to do : “All”, “Unresolved” or “Resolved”
public void enableExternalPDFDocumentHyperlinks(DocumentId documentId)

Enable external hyperlinks from a document

Parameters:
  • documentId – the documentId onto which externalHyperlinks should be enabled
public void enableInternalPDFDocumentHyperlinks(DocumentId documentId)

Enable internal hyperlinks from a document

Parameters:
  • documentId – the documentId onto which internalHyperlinks should be enabled
public void enablePDFDocumentHyperlinks(boolean enable)

Ask ARender to load/hide the PDF document hyperlinks for the current document

Parameters:
  • enable – is true when hyperlinks are to be loaded
public void evictDocument(String documentId)
public static ARenderJSAPI getARenderJS()

Get Singleton ARenderJSAPI

Returns:the currently initialized singleton for the currently running ARender instance in this window
public AnnotationJSAPI getAnnotationJSAPI()
public String getCurrentDocumentId()

Get currently opened DocumentId (DocumentPageLayout, as shown in DocumentContent)

Returns:the Current DocumentId
public DocumentBuilderJSAPI getDocumentBuilder()

Get the DocumentBuilder sub-API

Returns:the DocumentBuilder sub-API
public DocumentCompareJSAPI getDocumentCompareJSAPI()
public DocumentLayoutJSAPI getDocumentLayout()

Get the DocumentLayout sub-API

Returns:the DocumentLayout sub-API
public DocumentMetadataJSAPI getDocumentMetadata()

Get the DocumentMetadata sub-API

Returns:the DocumentMetadata sub-API
public DownloadDocumentJSAPI getDownloadDocumentJSAPI()
public FullScreenJSAPI getFullScreenJSAPI()
public GenericNotificationtJSAPI getGenericNotificationJSAPI()
public String getMasterDocumentId()

Get the master (root) DocumentId, the container of all DocumentPageLayout currently opened

Returns:the Master DocumentId
public void getPageForNamedDestination(String documentId, String namedDestination, NamedDestinationPageResultHandler handler)
public ShowPrintDialogJSAPI getPrintJSAPI()
public RotateJSAPI getRotateJSAPI()
public SearchJSAPI getSearchJSAPI()
public ThumbnailsJSAPI getThumbnailsJSAPI()
public ZoomGlassJSAPI getZoomGlassJSAPI()
public ZoomJSAPI getZoomJSAPI()
public void loadDocument(String url, DocumentLoadHandler documentLoadHandler, NotifyLoadingErrorHandler notifyLoadingErrorHandler)

Load Document

Parameters:
  • url – the unique identifier for the document to open
  • documentLoadHandler – the hook when document loading succeeded
  • notifyLoadingErrorHandler – the hook when document loading fails
public void loadDocuments(String gsonDocument, NotifyLoadingErrorHandler notifyLoadingErrorHandler, DocumentLoadHandler documentLoadHandler)
public PageRelativePosition newPageRelativePosition(float x, float y, float w, float h)

Build a new Position rectangle to provide to askChangePage()

Parameters:
  • x – the x coordinates of the position
  • y – the y coordinates of the position
  • w – the width of the position
  • h – the height of the position
Returns:

a PageRelativePosition object regarding those coordinates

public void onAnnotationModuleReady(AnnotationJSAPIClosure hook)
protected void onCurrentDocumentChangeEvent(CurrentDocumentChangeHandler currentDocumentChangeHandler, CurrentDocumentChangeEvent currentDocumentChangeEvent, DocumentMetadata documentMetadata)

Internal caller when current document metadata is fetched

Parameters:
  • currentDocumentChangeHandler – the handler that was called when currentDocumentChangeEvent is sent
  • currentDocumentChangeEvent – the currentDocumentChangeEvent that has been sent
  • documentMetadata – the metadata concerning the new current document
public void openDocument(String documentId)

Open document based on an Id provided by loadDocument()

Parameters:
  • documentId – the document id to load
public void openDocument(String documentId, int page)

Open document based on an Id provided by loadDocument() and a page

Parameters:
  • documentId – the document id to load
  • page – the page number to open on load
public void openPlugin(String pluginName, boolean openInMultiView)
public void preparePluginEvent(String key, String value, String pluginName)
public static void register(ARenderEventBus eventBus, ARenderJSAPIConfiguration config)

Export hooks for this EventBus

Parameters:
  • eventBus – the event bus to register to
  • config – the config fed from the ARenderJSAPIConfiguration
public void registerAllAsyncModulesStartedEvent(AllAsyncModulesStartedHandler allAsyncModulesStartedHandler)

Register a hook for async modules loading

Parameters:
  • allAsyncModulesStartedHandler – the hook to call when async modules are loaded
public void registerAnnotationsSavedEvent(NotifyAnnotationsSavedHandler notifyAnnotationsSavedHandler)
public void registerCommentDisplayHookEvent(DocumentId documentId, NotifyCommentDisplayHandler notifyCommentDisplayHandler)

Register a hook for annotation comment display

Parameters:
  • documentId – the documentId on which to hook onto
  • notifyCommentDisplayHandler – the handler that will receive the documentId as well as the display state of the comment
public void registerCurrentDocumentChangeEvent(CurrentDocumentChangeHandler currentDocumentChangeHandler)

Register a hook for document changes

Parameters:
  • currentDocumentChangeHandler – the hook to call when current document changes
public void registerDisplayLinkHandler(DisplayLinkHandler handler)
public void registerExternalBookmarkHandler(ExternalBookmarkSelectedHandler handler)
public void registerHyperlinkDisplayHookEvent(DocumentId documentId, NotifyHyperlinkDisplayHandler notifyHyperlinkDisplayHandler)

Register a hook for hyperlink display whether internal hyperlinks or external hyperlinks

Parameters:
  • documentId – the documentId to hook onto
  • notifyHyperlinkDisplayHandler – the handler that will receive both the documentId and if the hyperlink is internal of external
public void registerNotifyLoadingErrorEvent(NotifyLoadingErrorHandler notifyLoadingErrorHandler)

Register a hook for error while loading documents

Parameters:
  • notifyLoadingErrorHandler – the callback to call when error occurs
public void registerNotifyLogEvent(NotifyLogHandler notifyLogHandler)

Register a hook for notifications display

Parameters:
  • notifyLogHandler – the callback to call when log occurs
public void registerNotifyPageChangeEvent(NotifyPageChangeHandler notifyPageChangeHandler)

Register a hook for page changing

Parameters:
  • notifyPageChangeHandler – the callback to call when page changes
public void registerPanelLoadedConfigurationEvent(NotifyPanelLoadedConfigurationHandler notifyPanelLoadedConfigurationHandler)

Register a hook for button configuration

Parameters:
  • notifyPanelLoadedConfigurationHandler – the callback to call when configuration is loaded
public void setAnnotationJSAPI(AnnotationJSAPI annotationJSAPI)
public void setLinkColor(DisplayLinkEvent event, String color)
public void setLinkOpacity(DisplayLinkEvent event, String opacity)
public void setLinkStyle(DisplayLinkEvent event, String style)
public void setLogEventDisplay(PrepareSendLogEvent event, boolean display)
public void setLogEventLevel(PrepareSendLogEvent event, String level)
public void setLogEventMessage(PrepareSendLogEvent event, String newMessage)
public void setLogEventStackTrace(PrepareSendLogEvent event, String newMessage)