Class PrintCanvas

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers

public class PrintCanvas extends Canvas
PrintCanvas is a subclass of canvas which renders printable content HTML and provides APIs for printing this content as a separate document.
See Also:
  • Constructor Details

    • PrintCanvas

      public PrintCanvas()
    • PrintCanvas

      public PrintCanvas(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static PrintCanvas getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class Canvas
    • setExternalStylesheet

      public PrintCanvas setExternalStylesheet(String externalStylesheet)
      Setting this property will cause the specified stylesheet to be loaded in this print canvas's frame. The stylesheet should be specified as a URL to load.

      Note : This is an advanced setting

      Parameters:
      externalStylesheet - New externalStylesheet value. Default value is null
      Returns:
      PrintCanvas instance, for chaining setter calls
    • getExternalStylesheet

      public String getExternalStylesheet()
      Setting this property will cause the specified stylesheet to be loaded in this print canvas's frame. The stylesheet should be specified as a URL to load.
      Returns:
      Current externalStylesheet value. Default value is null
    • setPrintFrameURL

      public PrintCanvas setPrintFrameURL(String printFrameURL) throws IllegalStateException
      Location of the special printFrame html file provided as part of the Smart GWT libraries. This file must be present at the specified location for the printCanvas printing APIs.

      Note : This is an advanced setting

      Parameters:
      printFrameURL - New printFrameURL value. Default value is "[HELPERS]printFrame.html"
      Returns:
      PrintCanvas instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getPrintFrameURL

      public String getPrintFrameURL()
      Location of the special printFrame html file provided as part of the Smart GWT libraries. This file must be present at the specified location for the printCanvas printing APIs.
      Returns:
      Current printFrameURL value. Default value is "[HELPERS]printFrame.html"
    • print

      public void print()
      Show the native print dialog and allow the user to print the current HTML for this printCanvas. Note that the PrintCanvas must be drawn to be printed.
      Overrides:
      print in class Canvas
      See Also:
    • setHTML

      public void setHTML(String HTML, PrintCanvasCallback callback)
      Update the HTML content displayed in this print canvas. If the printCanvas is not yet drawn the HTML will be displayed when the canvas is drawn.

      Note that if the printCanvas is redrawn, or cleared and then drawn again, the HTML will be redisplayed inside the print canvas, and the specified callback will be fired again.

      Parameters:
      HTML - HTML to show in this print canvas
      callback - callback function to fire when the HTML is displayed. The callback will be passed a pointer to this print canvas as the first parameter with the name printPreview. If this canvas is not drawn when this method is called, the callback will not be fired until the canvas is drawn and the HTML rendered out into the page.
    • setDefaultProperties

      public static void setDefaultProperties(PrintCanvas printCanvasProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      printCanvasProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(PrintCanvasLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class Canvas