Class ViewerBuilder

java.lang.Object
com.levigo.jadice.web.client.ViewerBuilder

public class ViewerBuilder extends Object
Builder for Viewers
  • Constructor Details

    • ViewerBuilder

      public ViewerBuilder()
  • Method Details

    • setHasNativeScrollbars

      public ViewerBuilder setHasNativeScrollbars(boolean nativeScrollbars)
      Sets native scrollbars of the browser or special scrollbars.

      Scrollbar behavior

      • true, Browser specific Scrollbars (enhanced performance on some devices)
      • false, Special Scrollbars (big documents / deep zoom levels)
      • default, AutoSwitch via Device
      When using native scroll bars, the visibility of the scrollbars can be set via setScrollbarVisibility(ScrollbarVisibility).
      Parameters:
      nativeScrollbars - true for native scrollbars
      Returns:
      the builder itself
    • setType

      @Deprecated public ViewerBuilder setType(ViewerType type)
      Deprecated.
    • setPageView

      public ViewerBuilder setPageView(PageView pageView)
    • setUIStyle

      public ViewerBuilder setUIStyle(UIStyle style)
    • setPixelSize

      public ViewerBuilder setPixelSize(int width, int height)
      Sets the size of the viewer.

      default: fullsize

      Parameters:
      width - px
      height - px
      Returns:
      the builder itself
    • setSize

      public ViewerBuilder setSize(String width, String height)
      Sets the Size of the Viewer

      default: fullsize

      Parameters:
      width - the width
      height - the height
      Returns:
      the builder itself
    • setGlobalDeviceResolution

      public ViewerBuilder setGlobalDeviceResolution(int deviceResolution)
      Defines a globally defined default resolution.

      This will configure exactly one global resolution that will be used by all clients.

      Defaults to -1 which indicates that no globally defined resolution shall be used. When there is no individual resolution defined either for a specific client an estimation of the resolution will be used.

      Parameters:
      deviceResolution - the resolution to be used by all clients.
      Returns:
      the builder itself
    • setAutoDetectResolution

      public ViewerBuilder setAutoDetectResolution(boolean enabled)
      Enables automatic resolution detection.
      Parameters:
      enabled - controls if an automatic resolution detection shall be performed.
      Returns:
      The builder itself
    • setUseTouchScrollbar

      public ViewerBuilder setUseTouchScrollbar(boolean useTouchScrollbar)
      Defines whether the single touch scrollbar should be used or the default scrollbars.
      Parameters:
      useTouchScrollbar - whether the touch scrollbar should be used or not. By default it's not used.
      Returns:
      the builder itself
    • setHideScrollbarButtons

      public ViewerBuilder setHideScrollbarButtons(boolean hideScrollbarButtons)
      Defines whether the scrollbar should have buttons.
      Parameters:
      hideScrollbarButtons - Whether the scrollbar should have buttons. By default it's not used.
      Returns:
      the builder itself
    • setScrollbarVisibility

      public ViewerBuilder setScrollbarVisibility(ScrollbarVisibility scrollbarVisibility)
      Sets the ScrollbarVisibility for the created viewer to the desired value. The given scrollbar visibility will just be used if usage of native scrollbars is desired ( setHasNativeScrollbars(boolean)).
      Parameters:
      scrollbarVisibility - the desired ScrollbarVisibility
      Returns:
      the builder itself
    • isLevibatsLoaded

      public boolean isLevibatsLoaded()
    • setLevibatsLoaded

      public ViewerBuilder setLevibatsLoaded(boolean levibatsLoaded)
      Parameters:
      levibatsLoaded - if set to true, load the Levibats-Regular font. See the github project
    • setDisabledAutomaticFontLoading

      public ViewerBuilder setDisabledAutomaticFontLoading(boolean disableAutomaticFontLoading)
      We automatically call FontConfig#get usually so that the fonts for rendering annotations are loaded at the first possible moment. This is done because we rely on those fonts for a correct annotation rendering. If you want to disable this in order to dynamically load the fonts, please be aware to take extra care that the fonts are really loaded before an annotation rendering is triggered.
      Parameters:
      disableAutomaticFontLoading - if set to true, disable the automatic font loading
    • build

      public Viewer build()
      Builds an appropriate Viewer instance - a BasicViewer for mobile devices; a BigViewer otherwise.
      Returns:
      The new Viewer instance