Class BookmarkTool

java.lang.Object
java.util.Observable
com.nomagic.magicreport.engine.Tool
com.nomagic.magicreport.engine.tools.BookmarkTool
All Implemented Interfaces:
ITool, IVariable, Serializable, Cloneable

@OpenApiAll public class BookmarkTool extends Tool
Contains utilities functions for bookmark. Context name of this class is "bookmark". Public functions of this class are able to access via template by using $bookmark
Since:
Jun 19, 2007
See Also:
  • Field Details

  • Constructor Details

    • BookmarkTool

      public BookmarkTool()
  • Method Details

    • openURL

      public Link openURL(String url, Object content)
      Function to create hyperlink for open an URL.
       <code>
       $bookmark.openURL("http://www.nomagicasia.com", "NoMagic Asia")
       </code>
       
      Parameters:
      url - the url text. If null, empty string will be used.
      content - the text content. If null, empty string will be used.
      Returns:
      content with hyperlink in document format.
      See Also:
    • openURL

      public Link openURL(URL url, Object content)
      Function to create hyperlink for open an URL.
       <code>
       $bookmark.openURL($url, "NoMagic Asia")
       </code>
       
      Parameters:
      url - the URL instance. If null, empty string will be used.
      content - text content. If null, empty string will be used.
      Returns:
      content with hyperlink in RTF format.
      See Also:
    • openURL

      public Link openURL(URI uri, Object content)
      Function to create hyperlink for open an URL.
       <code>
       $bookmark.openURL($uri, "NoMagic Asia")
       </code>
       
      Parameters:
      uri - the URI instance. If null, empty string will be used.
      content - text content. If null, empty string will be used.
      Returns:
      content with hyperlink in RTF format.
      See Also:
    • open

      public Link open(Object content)
      Function to create hyperlink for bookmark. The bookmark ID will be automatically generated from content.
       <code>
          #foreach ($uc in $UseCase)
             $bookmark.open($uc.name)
          #end
          #foreach ($uc in $UseCase)
             $bookmark.create($uc.name)
          #end
       </code>
       
      Parameters:
      content - text content. If null, ID will be a digest of "0" and name will be a hash code of object.
      Returns:
      content with hyperlink in RTF format.
      See Also:
    • open

      public Link open(String bookmarkId, Object content)
      Function to create hyperlink for bookmark. bookmarkID value must match with parameter bookmarkID that pass into create(String, Object) function.
       <code>
          #foreach ($uc in $UseCase)
             $bookmark.open($uc.name)
          #end
          #foreach ($uc in $UseCase)
             $bookmark.create($uc.name)
          #end
       </code>
       
      Parameters:
      bookmarkId - the bookmark id. If null, digest of empty string will be used.
      content - text content. If null, empty string will be used.
      Returns:
      content with hyperlink in RTF format.
      See Also:
    • create

      public Bookmark create(Object bookmarkObject)
      Function to create bookmark. The bookmark ID will be automatically generated from bookmark object.
       <code>
          #foreach ($uc in $UseCase)
             $bookmark.open($uc.name)
          #end
          #foreach ($uc in $UseCase)
             $bookmark.create($uc.name)
          #end
       </code>
       
      Parameters:
      bookmarkObject - the bookmark object or content. If null, ID will be a digest of "0" and name will be a hash code of object.
      Returns:
      content with bookmark in RTF format.
    • create

      public Bookmark create(String bookmarkId, Object bookmarkObject)
      Function to create bookmark. The default element type for this function is "label".
       <code>
          #foreach ($uc in $UseCase)
             $bookmark.open($uc.ID, $uc.name)
          #end
          #foreach ($uc in $UseCase)
             $bookmark.create($uc.ID, $uc.name)
          #end
       </code>
       
      Parameters:
      bookmarkId - the bookmark. If null, digest of empty string will be used.
      bookmarkObject - the bookmark object or content. If null, empty string will be used.
      Returns:
      content with bookmark in RTF format.
    • create

      public Bookmark create(String bookmarkId, Object bookmarkObject, String elementType)
      Function to create bookmark with the specified element type.
       <code>
          #foreach ($uc in $UseCase)
             $bookmark.open($uc.ID, $uc.name)
          #end
          #foreach ($uc in $UseCase)
             $bookmark.create($uc.ID, $uc.name, "label")
          #end
       </code>
       
      Parameters:
      bookmarkId - the bookmark id. If null, digest of empty string will be used.
      bookmarkObject - the bookmark object or content. If null, empty string will be used.
      elementType - name of element type e.g. html tag.
      Returns:
      content with bookmark in format.
    • getBookmarkId

      public String getBookmarkId(String id)
      Return a bookmark id from given string.
      Parameters:
      id - original string value
      Returns:
      a bookmark id
      See Also:
    • createRef

      public TextReference createRef(String refId)
      Return a bookmark for REF from given string.
      Parameters:
      refId - the bookmark id. If null, digest of empty string will be used.
      Returns:
      a bookmark for REF
      See Also:
    • createRef

      public TextReference createRef(String refId, String content)
      Return a bookmark for REF from given string.
      Parameters:
      refId - the bookmark id. If null, digest of empty string will be used.
      content - text content
      Returns:
      a bookmark for REF
      See Also:
    • openRef

      public TextReference openRef(String refId)
      Return a reference to REF.
      Parameters:
      refId - the bookmark id. If null, digest of empty string will be used.
      Returns:
      a reference to REF
    • openRef

      public TextReference openRef(String refId, String refText)
      eturn a reference to REF.
      Parameters:
      refId - the bookmark id. If null, digest of empty string will be used.
      content - text content
      Returns:
      a reference to REF