Class KLibraryExtensions

java.lang.Object
de.cau.cs.kieler.klighd.krendering.extensions.KLibraryExtensions

public class KLibraryExtensions extends Object
Extension that allow a convenient use of the KRenderingLibrary mechanism.
Author:
uru
This class contains Xtend extension methods.
  • Constructor Details

    • KLibraryExtensions

      public KLibraryExtensions()
  • Method Details

    • getLibrary

      public KRenderingLibrary getLibrary(KNode node)
      Retrieves the rendering library valid for the given node. The library must be located in the node's topmost ancestor. If that ancestor does not yet have a rendering library attached, one is generated.
      Extension Category:
      library
      Code Example:
      val library = node.library
    • getFromLibrary

      public KRenderingRef getFromLibrary(KRenderingLibrary library, String id)
      Retrieves the rendering element that has been identified with the id string from the given rendering library.
      Extension Category:
      library
      Code Example:
      val libJunction = edge.source.getFromLibrary("ren_junction")
    • getFromLibrary

      public KRenderingRef getFromLibrary(KNode node, String id)
      Retrieves the rendering element that has been identified with the id string from the rendering library valid for the given node.
      Extension Category:
      library
      Code Example:
      val libJunction = edge.source.getFromLibrary("ren_junction")
    • addToLibrary

      public KRenderingRef addToLibrary(KRenderingLibrary library, String id, KRendering rendering)
      Identifies the passed rendering element with the passed id within the KRendering library. Afterwards the rendering can be retrieved from the library using the getFromLibrary method.
      Extension Category:
      library
      Code Example:
      edge.source.library.addToLibrary("ren_junction", createKRoundedRectangle => [ rr | rr.background = color rr.foreground = color rr.cornerWidth = 2 rr.cornerHeight = 2 rr.setPointPlacementData(LEFT, 0, 0, TOP, 0, 0, H_CENTRAL, V_CENTRAL, 0, 0, 10, 10) ] )
    • addToLibrary

      public KRenderingRef addToLibrary(KNode node, String id, KRendering rendering)
      Identifies the passed rendering element with the passed id within the KRendering library valid for the given node. Afterwards the rendering can be retrieved from the library using the getFromLibrary method.
      Extension Category:
      library
      Code Example:
      edge.source.addToLibrary("ren_junction", createKRoundedRectangle => [ rr | rr.background = color rr.foreground = color rr.cornerWidth = 2 rr.cornerHeight = 2 rr.setPointPlacementData(LEFT, 0, 0, TOP, 0, 0, H_CENTRAL, V_CENTRAL, 0, 0, 10, 10) ] )
    • addRenderingRef

      public KRenderingRef addRenderingRef(KGraphElement kge, KRendering rendering)