Class AbstractDocumentView

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Window
com.saperion.ngc.events.BaseWindow
com.saperion.ngc.viewer.AbstractDocumentView
All Implemented Interfaces:
EventChild, EventChildHandler, LogEventChildHandler, DocumentView, Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace, org.zkoss.zk.ui.sys.ComponentCtrl, org.zkoss.zul.ext.Framable
Direct Known Subclasses:
DocumentViewImpl, SapDocumentViewImpl

public abstract class AbstractDocumentView extends BaseWindow implements DocumentView
Abstract class that holds common methods for both, the SAP Web Viewer and the document viewer for the web client. User: chg Date: 07.03.12 Time: 16:37
See Also:
  • Field Details

    • structureButtonBox

      protected StructureButtons structureButtonBox
      Buttons for Download options in structure view.
    • viewerPresenter

      protected DocumentViewPresenter viewerPresenter
      The ViewerPresenter instance of this DocumentView.
    • zkDownloadMode

      protected boolean zkDownloadMode
      How to handle downloads.
    • maxViewSize

      protected long maxViewSize
      Limit of image size to display.
    • dontAskForDownload

      protected boolean dontAskForDownload
      Whether to ask before downloading.
    • localization

      protected final LocalizationUtil localization
      LocalizationUtil instance.
    • viewerComp

      protected ViewerComponent viewerComp
      Embedded viewer component.
    • viewerBean

      protected OpenDocumentBean viewerBean
      Viewer's control-bean.
    • viewerId

      protected String viewerId
      ID to identify the viewer.
    • mainLayout

      protected org.zkoss.zul.Borderlayout mainLayout
      Main layout component of this DocumentView.
    • multiDocumentList

      protected StructureList<?> multiDocumentList
      Structure view.
    • def

      protected com.saperion.ngc.iform.xml.ViewerType def
      Mask element definition.
    • viewerClass

      protected String viewerClass
      Class name of the embedded viewer component.
    • maskRights

      protected int maskRights
      Default mask-rights.
  • Constructor Details

    • AbstractDocumentView

      public AbstractDocumentView(String documentViewTitle, String documentViewBorder, Boolean closable)
      Constructor with title, border, closable option.
      Parameters:
      documentViewTitle - Title
      documentViewBorder - Border
      closable - Closable
    • AbstractDocumentView

      public AbstractDocumentView()
      Standard Constructor.
  • Method Details

    • openDocument

      public abstract void openDocument(DocumentId documentId, List<DocumentArchiveMetaInfo.ElementArchiveMetaInfo> documentElements, int element)
      Opens the specified url and displays the document.
      Specified by:
      openDocument in interface DocumentView
      Parameters:
      documentId - the document's id
      documentElements - the document's elements (sub documents)
      element - document element
      See Also:
    • onCreate

      public abstract void onCreate(org.zkoss.zk.ui.event.Event event)
      Event handler for onCreate event.
      Parameters:
      event - ZK event
    • onDisplayResultItem

      public abstract void onDisplayResultItem(org.zkoss.zk.ui.event.Event event)
      Display document.
      Specified by:
      onDisplayResultItem in interface DocumentView
      Parameters:
      event - Event
    • init

      protected void init()
      Initializes the viewer classes by setting things like layout, max view size, max document size and so on.
    • openSubDocument

      public void openSubDocument()
      Opens a sub document structure.
      Specified by:
      openSubDocument in interface DocumentView
      See Also:
    • isSizeLimitEnabled

      protected boolean isSizeLimitEnabled()
      Tells if the size limit for viewing documents is enabled. Therefore the max view size must be set to an integer value > 0.
      Returns:
      True if the max view size > 0, false else.
    • getNativeRequest

      protected jakarta.servlet.http.HttpServletRequest getNativeRequest()
      Gets the native request.
      Returns:
      the native request
    • onLogon

      public final void onLogon(org.zkoss.zk.ui.event.Event event)
      Event handler for logon event. The viewer will be enabled if the logon was successful.
      Specified by:
      onLogon in interface DocumentView
      Parameters:
      event - ZK event
    • disable

      public final void disable()
      Disables the viewer.
      Specified by:
      disable in interface DocumentView
    • enable

      public final void enable()
      Enables the viewer.
      Specified by:
      enable in interface DocumentView
    • reset

      public final void reset()
      Closes the current document.
      Specified by:
      reset in interface DocumentView
    • reset

      public final void reset(boolean showInitImage)
      Closes the current document.
      Specified by:
      reset in interface DocumentView
      Parameters:
      showInitImage - true, shows an initialization image (if supported by the viewer-component in use)
    • onResetGui

      public void onResetGui(org.zkoss.zk.ui.event.Event event)
      Handler for reset ui event.
      Specified by:
      onResetGui in interface DocumentView
      Parameters:
      event - ZK event
    • refreshView

      public final void refreshView()
      Refreshes the view with the last opened document.
      Specified by:
      refreshView in interface DocumentView
    • generateRandomViewerId

      protected String generateRandomViewerId()
      Generates a random ID used to identify each viewer. This ID is used by VirtualViewer to find it's session in the ContentHandler.
      Returns:
      the generated id
    • fillStructureView

      protected void fillStructureView(List<DocumentArchiveMetaInfo.ElementArchiveMetaInfo> infos, DocumentId documentId)
      Fills the structure list with available documents to show in the viewer component. Additionally, if documents are available to show, the buttons for download etc. of structure view are enabled or disabled if no documents are available.
      Parameters:
      infos - structure information
      documentId - id of the document
    • getPresenter

      public DocumentViewPresenter getPresenter()
      Gets the presenter.
      Returns:
      the presenter
    • getElementMetaInfo

      protected DocumentArchiveMetaInfo.ElementArchiveMetaInfo getElementMetaInfo(List<DocumentArchiveMetaInfo.ElementArchiveMetaInfo> documentTitles, int element)
      Gets information about a specific element.
      Parameters:
      documentTitles - structure information
      element - the element number
      Returns:
      the element's meta info
    • setPropertiesFileName

      public void setPropertiesFileName(String filename)
      Sets the name of a properties file for the internal viewer component. Optional parameter.
      Specified by:
      setPropertiesFileName in interface DocumentView
      Parameters:
      filename - the new properties file name
      See Also:
    • getPropertiesFileName

      public String getPropertiesFileName()
      Gets the properties file name.
      Specified by:
      getPropertiesFileName in interface DocumentView
      Returns:
      the properties file name
      See Also:
    • hasOpenChanges

      public boolean hasOpenChanges()
      Check open changes in viewer.
      Specified by:
      hasOpenChanges in interface DocumentView
      Returns:
      True, if open changes
      See Also:
    • getStructureList

      public StructureList<?> getStructureList()
      Gets the structure list.
      Specified by:
      getStructureList in interface DocumentView
      Returns:
      the structure list
      See Also:
    • getParentForm

      public IntelligentFormView getParentForm()
      Gets the parent form of this DocumentView.
      Specified by:
      getParentForm in interface DocumentView
      Returns:
      the parent form
    • getPageListStream

      protected InputStream getPageListStream(DocumentId documentId, List<DocumentArchiveMetaInfo.ElementArchiveMetaInfo> documentElements)
      Parameters:
      documentId - ID of the document
      documentElements - list of the document's elements
      Returns:
      stream containing the page-list (for ALF viewer)
    • makeViewerBean

      protected void makeViewerBean(DocumentId documentId, List<DocumentArchiveMetaInfo.ElementArchiveMetaInfo> documentElements, boolean currentRevision)
      Creates a new viewer control-bean or updates the existing one.
      Parameters:
      documentId - document id
      documentElements - elements of the document
      currentRevision - whether the current revision of the document should be resolved or not
    • canView

      protected boolean canView(DocumentId documentId)
      Checks if the user is allowed to display the document.
      Parameters:
      documentId - id of the document
      Returns:
      true if document can be displayed
    • canDownload

      protected boolean canDownload(DocumentId documentId)
      Checks if the user is allowed to download the document.
      Parameters:
      documentId - id of the current document
      Returns:
      true if document can be downloaded
    • inIfomPopup

      protected boolean inIfomPopup()
      Returns:
      true if this document view is part of an iform-popup.
    • setEnableLoadingMessage

      public void setEnableLoadingMessage(boolean enable)
      Enables or disables the loading message that will be shown when the viewer is initiated. Note that not all viewer-components support showing a loading-message.
      Specified by:
      setEnableLoadingMessage in interface DocumentView
      Parameters:
      enable - enabled or disabled
      See Also:
    • isEnableLoadingMessage

      public boolean isEnableLoadingMessage()
      Specified by:
      isEnableLoadingMessage in interface DocumentView
      Returns:
      true if loading message is enabled
      See Also:
    • setViewerClass

      public void setViewerClass(String clazz)
      Sets the class-name of the contained viewer-component.
      Specified by:
      setViewerClass in interface DocumentView
      Parameters:
      clazz - the class-name of the viewer-component
      See Also:
    • getViewerClass

      public String getViewerClass()
      Gets the class-name of the contained viewer-component.
      Specified by:
      getViewerClass in interface DocumentView
      Returns:
      the class-name of the contained viewer-component.
      See Also:
    • setStructureButtonsBoxShown

      public void setStructureButtonsBoxShown(boolean showStructureButtonsBox)
      Description copied from interface: DocumentView
      Set the visibility of the its structure button box and its containingn structure buttons of the structure view.
      Specified by:
      setStructureButtonsBoxShown in interface DocumentView
      Parameters:
      showStructureButtonsBox - Removes the structure buttons and its surrounding structure button box if it is set to false and shows the buttons if it is set to true.
    • isStructureButtonsBoxShown

      public boolean isStructureButtonsBoxShown()
      Description copied from interface: DocumentView
      Tells you if the structure buttons of the structure view are shown or not. Default is true.
      Specified by:
      isStructureButtonsBoxShown in interface DocumentView
      Returns:
      True if structure buttons and its surrounding structure button box of structure view are shown, false else.
    • enableStructureButtonsWhen

      protected void enableStructureButtonsWhen(boolean enable)
      Parameters:
      enable - enable or disabled structure buttons
    • setStructureEnabled

      public void setStructureEnabled(boolean enabled)
      Enables or disables the structure view.
      Specified by:
      setStructureEnabled in interface DocumentView
      Parameters:
      enabled - enabled/disabled
      See Also:
    • isStructureEnabled

      public boolean isStructureEnabled()
      Specified by:
      isStructureEnabled in interface DocumentView
      Returns:
      true if structure view is enabled
      See Also:
    • canModifyDocument

      public boolean canModifyDocument()
      Description copied from interface: DocumentView
      Checks if the ViewerComponent used by this viewer can modify documents.
      Specified by:
      canModifyDocument in interface DocumentView
      Returns:
      can edit documents
    • canShowRevisions

      public boolean canShowRevisions()
      Description copied from interface: DocumentView
      Checks if the ViewerComponent used by this viewer can show the document revisions.
      Specified by:
      canShowRevisions in interface DocumentView
      Returns:
      true or false
      See Also: