Class KLabelExtensions

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

public class KLabelExtensions 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, ssm
This class contains Xtend extension methods.
  • Constructor Details

    • KLabelExtensions

      public KLabelExtensions()
  • Method Details

    • getLabel

      public KLabel getLabel(Object o, KLabeledGraphElement labeledElement)
      A convenient getter preserving the element image relation by a create extension.
    • createLabel

      public KLabel createLabel(KLabeledGraphElement labeledElement)
      Convenience creator of KLabels that are not related to semantic elements. It is just syntactic sugar.
    • createLabel

      public KLabel createLabel(Object o, KLabeledGraphElement labeledElement)
      An alias of getLabel(Object, KLabeledGraphElement) allowing to express in business that the KLabel will be created at this place. It is just syntactic sugar.
    • getLabel

      public KLabel getLabel(Object o1, Object o2, KLabeledGraphElement labeledElement)
      A convenient getter associating the label with to elements preserving the element image relation by a create extension.
    • createLabel

      public KLabel createLabel(Object o1, Object o2, KLabeledGraphElement labeledElement)
      An alias of getLabel(Object, Object, KLabeledGraphElement) allowing to express in business that the KLabel will be created at this place. It is just syntactic sugar.
    • setLabelSize

      public KLabel setLabelSize(KLabel label, float width, float height)
    • setLabelPos

      public KLabel setLabelPos(KLabel label, float x, float y)
    • addLayoutParam

      public <T> KLabel addLayoutParam(KLabel label, org.eclipse.elk.graph.properties.IProperty<? super T> property, T value)
    • configureInsideCenteredNodeLabel

      public KLabel configureInsideCenteredNodeLabel(KLabel label, String labelText)
      Configures an inside centrally-aligned node label!
    • configureInsideCenteredNodeLabel

      public KLabel configureInsideCenteredNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside centrally-aligned node label!
    • configureInsideCenteredNodeLabel

      public KLabel configureInsideCenteredNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside centrally-aligned node label!
    • addInsideCenteredNodeLabel

      public KLabel addInsideCenteredNodeLabel(KNode node, String labelText)
      Adds an inside bottom right-aligned node label!
    • addInsideCenteredNodeLabel

      public KLabel addInsideCenteredNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside bottom right-aligned node label!
    • addInsideCenteredNodeLabel

      public KLabel addInsideCenteredNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside bottom right-aligned node label!
    • configureInsideBottomCenteredNodeLabel

      public KLabel configureInsideBottomCenteredNodeLabel(KLabel label, String labelText)
      Configures an inside bottom centrally-aligned node label!
    • configureInsideBottomCenteredNodeLabel

      public KLabel configureInsideBottomCenteredNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside bottom centrally-aligned node label!
    • configureInsideBottomCenteredNodeLabel

      public KLabel configureInsideBottomCenteredNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside bottom centrally-aligned node label!
    • addInsideBottomCenteredNodeLabel

      public KLabel addInsideBottomCenteredNodeLabel(KNode node, String labelText)
      Adds an inside bottom centrally-aligned node label!
    • addInsideBottomCenteredNodeLabel

      public KLabel addInsideBottomCenteredNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside bottom centrally-aligned node label!
    • addInsideBottomCenteredNodeLabel

      public KLabel addInsideBottomCenteredNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside bottom centrally-aligned node label!
    • configureInsideBottomLeftNodeLabel

      public KLabel configureInsideBottomLeftNodeLabel(KLabel label, String labelText)
      Configures an inside bottom left-aligned node label!
    • configureInsideBottomLeftNodeLabel

      public KLabel configureInsideBottomLeftNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside bottom left-aligned node label!
    • configureInsideBottomLeftNodeLabel

      public KLabel configureInsideBottomLeftNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside bottom left-aligned node label!
    • addInsideBottomLeftNodeLabel

      public KLabel addInsideBottomLeftNodeLabel(KNode node, String labelText)
      Adds an inside bottom left-aligned node label!
    • addInsideBottomLeftNodeLabel

      public KLabel addInsideBottomLeftNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside bottom left-aligned node label!
    • addInsideBottomLeftNodeLabel

      public KLabel addInsideBottomLeftNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside bottom left-aligned node label!
    • configureInsideBottomRightNodeLabel

      public KLabel configureInsideBottomRightNodeLabel(KLabel label, String labelText)
      Configures an inside bottom right-aligned node label!
    • configureInsideBottomRightNodeLabel

      public KLabel configureInsideBottomRightNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside bottom right-aligned node label!
    • configureInsideBottomRightNodeLabel

      public KLabel configureInsideBottomRightNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside bottom right-aligned node label!
    • addInsideBottomRightNodeLabel

      public KLabel addInsideBottomRightNodeLabel(KNode node, String labelText)
      Adds an inside bottom right-aligned node label!
    • addInsideBottomRightNodeLabel

      public KLabel addInsideBottomRightNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside bottom right-aligned node label!
    • addInsideBottomRightNodeLabel

      public KLabel addInsideBottomRightNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside bottom right-aligned node label!
    • configureInsideTopCenteredNodeLabel

      public KLabel configureInsideTopCenteredNodeLabel(KLabel label, String labelText)
      Configures an inside top centrally-aligned node label!
    • configureInsideTopCenteredNodeLabel

      public KLabel configureInsideTopCenteredNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside top centrally-aligned node label!
    • configureInsideTopCenteredNodeLabel

      public KLabel configureInsideTopCenteredNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside top centrally-aligned node label!
    • addInsideTopCenteredNodeLabel

      public KLabel addInsideTopCenteredNodeLabel(KNode node, String labelText)
      Adds an inside top centrally-aligned node label!
    • addInsideTopCenteredNodeLabel

      public KLabel addInsideTopCenteredNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside top centrally-aligned node label!
    • addInsideTopCenteredNodeLabel

      public KLabel addInsideTopCenteredNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside top centrally-aligned node label!
    • configureInsideTopLeftNodeLabel

      public KLabel configureInsideTopLeftNodeLabel(KLabel label, String labelText)
      Configures an inside top left-aligned node label!
    • configureInsideTopLeftNodeLabel

      public KLabel configureInsideTopLeftNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside top left-aligned node label!
    • configureInsideTopLeftNodeLabel

      public KLabel configureInsideTopLeftNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside top left-aligned node label!
    • addInsideTopLeftNodeLabel

      public KLabel addInsideTopLeftNodeLabel(KNode node, String labelText)
      Adds an inside top left-aligned node label!
    • addInsideTopLeftNodeLabel

      public KLabel addInsideTopLeftNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside top left-aligned node label!
    • addInsideTopLeftNodeLabel

      public KLabel addInsideTopLeftNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside top left-aligned node label!
    • configureInsideTopRightNodeLabel

      public KLabel configureInsideTopRightNodeLabel(KLabel label, String labelText)
      Configures an inside top right-aligned node label!
    • configureInsideTopRightNodeLabel

      public KLabel configureInsideTopRightNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an inside top right-aligned node label!
    • configureInsideTopRightNodeLabel

      public KLabel configureInsideTopRightNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside top right-aligned node label!
    • addInsideTopRightNodeLabel

      public KLabel addInsideTopRightNodeLabel(KNode node, String labelText)
      Adds an inside top right-aligned node label!
    • addInsideTopRightNodeLabel

      public KLabel addInsideTopRightNodeLabel(KNode node, String labelText, int fontSize)
      Adds an inside top right-aligned node label!
    • addInsideTopRightNodeLabel

      public KLabel addInsideTopRightNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an inside top right-aligned node label!
    • configureOutsideBottomCenteredNodeLabel

      public KLabel configureOutsideBottomCenteredNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside bottom centrally-aligned node label!
    • configureOutsideBottomCenteredNodeLabel

      public KLabel configureOutsideBottomCenteredNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside bottom centrally-aligned node label!
    • configureOutsideBottomCenteredNodeLabel

      public KLabel configureOutsideBottomCenteredNodeLabel(KLabel label, String labelText)
      Configures an outside bottom centrally-aligned node label!
    • addOutsideBottomCenteredNodeLabel

      public KLabel addOutsideBottomCenteredNodeLabel(KNode node, String labelText)
      Adds an outside bottom centrally-aligned node label!
    • addOutsideBottomCenteredNodeLabel

      public KLabel addOutsideBottomCenteredNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside bottom centrally-aligned node label!
    • addOutsideBottomCenteredNodeLabel

      public KLabel addOutsideBottomCenteredNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside bottom centrally-aligned node label!
    • configureOutsideBottomLeftNodeLabel

      public KLabel configureOutsideBottomLeftNodeLabel(KLabel label, String labelText)
      Configures an outside bottom left-aligned node label!
    • configureOutsideBottomLeftNodeLabel

      public KLabel configureOutsideBottomLeftNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside bottom left-aligned node label!
    • configureOutsideBottomLeftNodeLabel

      public KLabel configureOutsideBottomLeftNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside bottom left-aligned node label!
    • addOutsideBottomLeftNodeLabel

      public KLabel addOutsideBottomLeftNodeLabel(KNode node, String labelText)
      Adds an outside bottom left-aligned node label!
    • addOutsideBottomLeftNodeLabel

      public KLabel addOutsideBottomLeftNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside bottom left-aligned node label!
    • addOutsideBottomLeftNodeLabel

      public KLabel addOutsideBottomLeftNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside bottom left-aligned node label!
    • configureOutsideBottomRightNodeLabel

      public KLabel configureOutsideBottomRightNodeLabel(KLabel label, String labelText)
      Configures an outside bottom right-aligned node label!
    • configureOutsideBottomRightNodeLabel

      public KLabel configureOutsideBottomRightNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside bottom right-aligned node label!
    • configureOutsideBottomRightNodeLabel

      public KLabel configureOutsideBottomRightNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside bottom right-aligned node label!
    • addOutsideBottomRightNodeLabel

      public KLabel addOutsideBottomRightNodeLabel(KNode node, String labelText)
      Adds an outside bottom right-aligned node label!
    • addOutsideBottomRightNodeLabel

      public KLabel addOutsideBottomRightNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside bottom right-aligned node label!
    • addOutsideBottomRightNodeLabel

      public KLabel addOutsideBottomRightNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside bottom right-aligned node label!
    • configureOutsideTopCenteredNodeLabel

      public KLabel configureOutsideTopCenteredNodeLabel(KLabel label, String labelText)
      Configures an outside top centrally-aligned node label!
    • configureOutsideTopCenteredNodeLabel

      public KLabel configureOutsideTopCenteredNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside top centrally-aligned node label!
    • configureOutsideTopCenteredNodeLabel

      public KLabel configureOutsideTopCenteredNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside top centrally-aligned node label!
    • addOutsideTopCenteredNodeLabel

      public KLabel addOutsideTopCenteredNodeLabel(KNode node, String labelText)
      Adds an outside top centrally-aligned node label!
    • addOutsideTopCenteredNodeLabel

      public KLabel addOutsideTopCenteredNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside top centrally-aligned node label!
    • addOutsideTopCenteredNodeLabel

      public KLabel addOutsideTopCenteredNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside top centrally-aligned node label!
    • configureOutsideTopLeftNodeLabel

      public KLabel configureOutsideTopLeftNodeLabel(KLabel label, String labelText)
      Configures an outside top left-aligned node label!
    • configureOutsideTopLeftNodeLabel

      public KLabel configureOutsideTopLeftNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside top left-aligned node label!
    • configureOutsideTopLeftNodeLabel

      public KLabel configureOutsideTopLeftNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside top left-aligned node label!
    • addOutsideTopLeftNodeLabel

      public KLabel addOutsideTopLeftNodeLabel(KNode node, String labelText)
      Adds an outside top left-aligned node label!
    • addOutsideTopLeftNodeLabel

      public KLabel addOutsideTopLeftNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside top left-aligned node label!
    • addOutsideTopLeftNodeLabel

      public KLabel addOutsideTopLeftNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside top left-aligned node label!
    • configureOutsideTopRightNodeLabel

      public KLabel configureOutsideTopRightNodeLabel(KLabel label, String labelText)
      Configures an outside top right-aligned node label!
    • configureOutsideTopRightNodeLabel

      public KLabel configureOutsideTopRightNodeLabel(KLabel label, String labelText, int fontSize)
      Configures an outside top right-aligned node label!
    • configureOutsideTopRightNodeLabel

      public KLabel configureOutsideTopRightNodeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an outside top right-aligned node label!
    • addOutsideTopRightNodeLabel

      public KLabel addOutsideTopRightNodeLabel(KNode node, String labelText)
      Adds an outside top right-aligned node label!
    • addOutsideTopRightNodeLabel

      public KLabel addOutsideTopRightNodeLabel(KNode node, String labelText, int fontSize)
      Adds an outside top right-aligned node label!
    • addOutsideTopRightNodeLabel

      public KLabel addOutsideTopRightNodeLabel(KNode node, String labelText, int fontSize, String fontName)
      Adds an outside top right-aligned node label!
    • configureInsidePortLabel

      public KLabel configureInsidePortLabel(KLabel label, String labelText)
      Configures an inside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • configureInsidePortLabel

      public KLabel configureInsidePortLabel(KLabel label, String labelText, int fontSize)
      Configures an inside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • configureInsidePortLabel

      public KLabel configureInsidePortLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures an inside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • addInsidePortLabel

      public KLabel addInsidePortLabel(KPort port, String labelText)
      Adds an inside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • addInsidePortLabel

      public KLabel addInsidePortLabel(KPort port, String labelText, int fontSize)
      Adds an inside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • addInsidePortLabel

      public KLabel addInsidePortLabel(KPort port, String labelText, int fontSize, String fontName)
      Adds an inside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • configureOutsidePortLabel

      public KLabel configureOutsidePortLabel(KLabel label, String labelText)
      Configures a outside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • configureOutsidePortLabel

      public KLabel configureOutsidePortLabel(KLabel label, String labelText, int fontSize)
      Configures a outside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • configureOutsidePortLabel

      public KLabel configureOutsidePortLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures a outside port label!
      Note that label must be already contained in a KPort that in turn is contained in a KNode in order to let the configuration be performed properly.
    • addOutsidePortLabel

      public KLabel addOutsidePortLabel(KPort port, String labelText)
      Adds an outside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • addOutsidePortLabel

      public KLabel addOutsidePortLabel(KPort port, String labelText, int fontSize)
      Adds an outside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • addOutsidePortLabel

      public KLabel addOutsidePortLabel(KPort port, String labelText, int fontSize, String fontName)
      Adds an outside label to KPort port!
      Note that port must be already contained in a KNode in order to let the configuration be performed properly.
    • configureCenterEdgeLabel

      public KLabel configureCenterEdgeLabel(KLabel label, String labelText)
      Configures a central (main) edge label, e.g. a state transition guard/effect label!
    • configureCenterEdgeLabel

      public KLabel configureCenterEdgeLabel(KLabel label, String labelText, int fontSize)
      Configures a central (main) edge label, e.g. a state transition guard/effect label!
    • configureCenterEdgeLabel

      public KLabel configureCenterEdgeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures a central (main) edge label, e.g. a state transition guard/effect label!
    • addCenterEdgeLabel

      public KLabel addCenterEdgeLabel(KEdge edge, String labelText)
      Adds a central (main) label to KEdge edge.
    • addCenterEdgeLabel

      public KLabel addCenterEdgeLabel(KEdge edge, String labelText, int fontSize)
      Adds a central (main) label to KEdge edge.
    • addCenterEdgeLabel

      public KLabel addCenterEdgeLabel(KEdge edge, String labelText, int fontSize, String fontName)
      Adds a central (main) label to KEdge edge.
    • configureHeadEdgeLabel

      public KLabel configureHeadEdgeLabel(KLabel label, String labelText)
      Configures a head edge label, e.g. the cardinality of a relation in an class diagram!
    • configureHeadEdgeLabel

      public KLabel configureHeadEdgeLabel(KLabel label, String labelText, int fontSize)
      Configures a head edge label, e.g. the cardinality of a relation in an class diagram!
    • configureHeadEdgeLabel

      public KLabel configureHeadEdgeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures a head edge label, e.g. the cardinality of a relation in an class diagram!
    • addHeadEdgeLabel

      public KLabel addHeadEdgeLabel(KEdge edge, String labelText)
      Adds a head label (target side) to KEdge edge.
    • addHeadEdgeLabel

      public KLabel addHeadEdgeLabel(KEdge edge, String labelText, int fontSize)
      Adds a head label (target side) to KEdge edge.
    • addHeadEdgeLabel

      public KLabel addHeadEdgeLabel(KEdge edge, String labelText, int fontSize, String fontName)
      Adds a head label (target side) to KEdge edge.
    • configureTailEdgeLabel

      public KLabel configureTailEdgeLabel(KLabel label, String labelText)
      Configures a tail edge label, e.g. the cardinality of a relation in an class diagram!
    • configureTailEdgeLabel

      public KLabel configureTailEdgeLabel(KLabel label, String labelText, int fontSize)
      Configures a tail edge label, e.g. the cardinality of a relation in an class diagram!
    • configureTailEdgeLabel

      public KLabel configureTailEdgeLabel(KLabel label, String labelText, int fontSize, String fontName)
      Configures a tail edge label, e.g. the cardinality of a relation in an class diagram!
    • addTailEdgeLabel

      public KLabel addTailEdgeLabel(KEdge edge, String labelText)
      Adds a tail label (source side) to KEdge edge.
    • addTailEdgeLabel

      public KLabel addTailEdgeLabel(KEdge edge, String labelText, int fontSize)
      Adds a tail label (source side) to KEdge edge.
    • addTailEdgeLabel

      public KLabel addTailEdgeLabel(KEdge edge, String labelText, int fontSize, String fontName)
      Adds a tail label (source side) to KEdge edge.
    • getFirstText

      public KText getFirstText(KLabel label)
      Reveals the first KText element of a label KRendering, which is assumed to be the label text configuration. This is useful for additionally linking it with the business element represented by the label. Note: KLabelNodes of the Piccolo2D binding are configured to ignore the KText element while selecting them. Thus, only the KLabel needs to be linked to the source element.
    • foreground

      public KLabel foreground(KLabel label, KColor color)
      Shortcut for setting the label's foreground color directly.
    • background

      public KLabel background(KLabel label, KColor color)
      Shortcut for setting the label's background color directly.