Link (Freeplane API 1.11.10)
Description: declaration: package: org.freeplane.api, interface: Link

Package org.freeplane.api

# Interface Link

All Superinterfaces:
  `LinkRO`

All Known Subinterfaces:
  `Proxy.Link`

public interface Link extends LinkRO
Node's link: `node.link` - read-write. To set links use the attributes of the `Link` and `LinkRO` object:

     // a normal href
     node.link.text = 'http://www.google.com'
     // create a link to the parent node
     node.link.node = node.parent
     // if you have a URI object
     node.link.uri = new URI('http://www.google.com')
     // file
     node.link.file = map.file

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `remove()`
  removes the link.
  `boolean`
  `set(String target)`
  Deprecated.
  since 1.2 - use `setText(String)` instead.
  `void`
  `setFile(File file)`
  sets target to file.
  `void`
  `setNode(Node node)`
  target is a node of the same map.
  `void`
  `setText(String target)`
  target is a stringified URI.
  `void`
  `setUri(URI uri)`
  sets target to uri.

  ### Methods inherited from interface org.freeplane.api.LinkRO

  `get, getFile, getNode, getText, getUri`

- ## Method Details

  - ### setText

    void setText(String target)
    target is a stringified URI. Removes any link if uri is null. To get a local link (i.e. to another node) target should be: "#" + nodeId or better use setNode(Node).
    Throws:
      `IllegalArgumentException` - if target is not convertible into a `URI`.
    Since:
      1.2

  - ### setUri

    void setUri(URI uri)
    sets target to uri. Removes any link if uri is null.
    Since:
      1.2

  - ### setFile

    void setFile(File file)
    sets target to file. Removes any link if file is null.
    Since:
      1.2

  - ### setNode

    void setNode(Node node)
    target is a node of the same map. Shortcut for setTarget("#" + node.nodeId) Removes any link if node is null.
    Throws:
      `IllegalArgumentException` - if node belongs to another map.
    Since:
      1.2

  - ### set

    @Deprecated boolean set(String target)
    Deprecated.
    since 1.2 - use `setText(String)` instead.
    Returns:
      true if target could be converted to an URI and false otherwise.

  - ### remove

    boolean remove()
    removes the link. Same as `node.link.text = null`.
    Returns:
      `true` if there was a link to remove.
    Since:
      1.4