Class KPortExtensions

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

public class KPortExtensions extends Object
Provides some helpful extension methods for simplifying the composition of KGraph/KRendering-based view models.

In order to employ them beyond KLighD diagram syntheses you best declare a field of type KNodeExtensions in your class and annotate it with Inject.

Make sure to bind the ViewSynthesisShared annotation in the employed Injector to a Scope, e.g. by calling Guice.createInjector(KRenderingExtensionsPlugin.createSingletonScopeBindingModule()); or Guice.createInjector(KRenderingExtensionsPlugin.createNoScopeBindingModule());.

By means of that Injector you may get a new instance of your class, or you may inject the above mentioned attribute within instances of your class, e.g. by calling injector.injectMembers(this) in the constructor of your class.
Author:
chsch, nre
This class contains Xtend extension methods.
  • Constructor Details

    • KPortExtensions

      public KPortExtensions()
  • Method Details

    • portExists

      public boolean portExists(Object... os)
      A convenient test method to check whether or not a specific port exists in the create extension
    • registerExistingPort

      public KPort registerExistingPort(KPort port, Object... os)
      A convenient method to register a port that was not created via the create extension.
      Returns:
      the previous port associated with the given object(s), or null if there was no port yet.
    • getPort

      public KPort getPort(Object o1)
      A convenient port getter based on a single business object preserving the element image relation by a create extension.
    • getPort

      public KPort getPort(Object o1, Object o2)
      A convenient port getter based on a two business objects preserving the element image relation by a create extension.
    • getPort

      public KPort getPort(Object o1, Object o2, Object o3)
      A convenient port getter based on a three business objects preserving the element image relation by a create extension.
    • getPort

      public KPort getPort(Object o1, Object o2, Object o3, Object o4)
      A convenient port getter based on a four business objects preserving the element image relation by a create extension.
    • getPort

      public KPort getPort(Object... os)
      A convenient port getter based on a single business object preserving the element image relation by a create extension.
    • createPort

      public KPort createPort()
      A convenience method to create a KPort without relating it to a business object.
    • createPort

      public KPort createPort(Object o1)
      An alias of getPort(Object o1) allowing to express in business that the KPort will be created at this place. It is just syntactic sugar.
    • createPort

      public KPort createPort(Object o1, Object o2)
      An alias of getPort(Object o1, Object o2) allowing to express in business that the KPort will be created at this place. It is just syntactic sugar.
    • createPort

      public KPort createPort(Object o1, Object o2, Object o3)
      An alias of getPort(Object o1, Object o2, Object o3) allowing to express in business that the KPort will be created at this place. It is just syntactic sugar.
    • createPort

      public KPort createPort(Object o1, Object o2, Object o3, Object o4)
      An alias of getPort(Object o1, Object o2, Object o3, Object o4) allowing to express in business that the KPort will be created at this place. It is just syntactic sugar.
    • createPort

      public KPort createPort(Object... os)
      An alias of getPort(Object o1) allowing to express in business that the KPort will be created at this place. It is just syntactic sugar.
    • createLabeledEPort

      public KPort createLabeledEPort(KNode node, String label, Object o1)
      Creates a port and a related port figure as well as a port label onto the east side of a given node with the port label text 'label'. The port is related to the given EObjects. The create nature of these extensions avoids the relocation the an already created port due to the recall of the initializer extension.
    • createLabeledEPort

      public KPort createLabeledEPort(KNode node, String label, Object o1, Object o2)
    • createLabeledEPort

      public KPort createLabeledEPort(KNode node, String label, Object o1, Object o2, Object o3)
    • createLabeledEPort

      public KPort createLabeledEPort(KNode node, String label, Object o1, Object o2, Object o3, Object o4)
    • createLabeledNPort

      public KPort createLabeledNPort(KNode node, String label, Object o1)
      Creates an anchor and a related port figure as well as a port label onto the north side of a given shape with the port label text 'label'. The anchor is related to the given EObjects. The create nature of these extensions avoids the relocation the an already created port due to the recall of the initializer extension.
    • createLabeledNPort

      public KPort createLabeledNPort(KNode node, String label, Object o1, Object o2)
    • createLabeledNPort

      public KPort createLabeledNPort(KNode node, String label, Object o1, Object o2, Object o3)
    • createLabeledNPort

      public KPort createLabeledNPort(KNode node, String label, Object o1, Object o2, Object o3, Object o4)
    • createLabeledSPort

      public KPort createLabeledSPort(KNode node, String label, Object o1)
      Creates an anchor and a related port figure as well as a port label onto the south side of a given shape with the port label text 'label'. The anchor is related to the given EObjects. The create nature of these extensions avoids the relocation the an already created port due to the recall of the initializer extension.
    • createLabeledSPort

      public KPort createLabeledSPort(KNode node, String label, Object o1, Object o2)
    • createLabeledSPort

      public KPort createLabeledSPort(KNode node, String label, Object o1, Object o2, Object o3)
    • createLabeledSPort

      public KPort createLabeledSPort(KNode node, String label, Object o1, Object o2, Object o3, Object o4)
    • createLabeledWPort

      public KPort createLabeledWPort(KNode node, String label, Object o1)
      Creates an anchor and a related port figure as well as a port label onto the west side of a given shape with the port label text 'label'. The anchor is related to the given EObjects. The create nature of these extensions avoids the relocation the an already created port due to the recall of the initializer extension.
    • createLabeledWPort

      public KPort createLabeledWPort(KNode node, String label, Object o1, Object o2)
    • createLabeledWPort

      public KPort createLabeledWPort(KNode node, String label, Object o1, Object o2, Object o3)
    • createLabeledWPort

      public KPort createLabeledWPort(KNode node, String label, Object o1, Object o2, Object o3, Object o4)
    • getFirstText

      public KText getFirstText(KPort port)
      Reveals the first KText element of a port KRendering, which is assumed to be the port label. This is useful for additionally linking it with the business element represented by the port.
    • setPortSize

      public KPort setPortSize(KPort port, float with, float height)
    • setPortPos

      public KPort setPortPos(KPort port, float x, float y)
    • addLayoutParam

      public <T> KPort addLayoutParam(KPort port, org.eclipse.elk.graph.properties.IProperty<? super T> property, T value)
    • getShapeLayout

      public KShapeLayout getShapeLayout(KPort port)
    • portLabelFontSize

      public KFontSize portLabelFontSize()
    • portEdgeLengthMemo

      public org.eclipse.elk.core.util.Maybe<Float> portEdgeLengthMemo()
    • getPortEdgeLength

      public Float getPortEdgeLength()
    • setPortEdgeLength

      public void setPortEdgeLength(Float f)
    • getPortTopOffset

      public Float getPortTopOffset()
    • setPortTopOffset

      public void setPortTopOffset(Float f)
    • getVerticalPortSpacing

      public Float getVerticalPortSpacing()
    • setVerticalPortSpacing

      public void setVerticalPortSpacing(Float f)
    • getInlyingPortLabels

      public Boolean getInlyingPortLabels()
    • setInlyingPortLabels

      public void setInlyingPortLabels(Boolean b)
    • nextEPortYPosition

      public Float nextEPortYPosition(KNode node)
    • nextNPortYPosition

      public Float nextNPortYPosition(KNode node)
    • nextSPortYPosition

      public Float nextSPortYPosition(KNode node)
    • nextWPortYPosition

      public Float nextWPortYPosition(KNode node)