Class KGraphDataUtil

java.lang.Object
de.cau.cs.kieler.klighd.kgraph.util.KGraphDataUtil

public final class KGraphDataUtil extends Object
Utilites for interacting with graphs based on metadata from the extension services.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A tree iterator that skips properties of EMapPropertyHolders.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.google.common.base.Predicate<EMapPropertyHolder>
    A predicate returning true if the passed element is an instance of IPropertyHolder.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    loadDataElement(org.eclipse.elk.core.data.LayoutMetaDataService dataService, org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value)
    Configures the layout option given by key and value in the given IPropertyHolder, if key denominates a registered Layout Option; configures a LayoutOptionProxy otherwise.

    Extracted that part into a dedicated method in order to be able to re-use it, e.g.
    static void
    loadDataElement(org.eclipse.elk.core.data.LayoutMetaDataService dataService, org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value, Map<String,? extends org.eclipse.elk.graph.properties.IProperty<?>> knownProps)
    Configures the layout option given by key and value in the given IPropertyHolder, if key denominates a registered Layout Option; configures a LayoutOptionProxy otherwise.

    Extracted that part into a dedicated method in order to be able to re-use it, e.g.
    static void
    loadDataElements(KNode graph, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
    Loads all IProperty of KLayoutData elements of a KGraph by deserializing PersistentEntry tuples.
    static KNode
    loadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
    Loads all IProperty of elements that pass the test performed by the handledTypes predicate of a KGraph by deserializing PersistentEntry tuples.
    static KNode
    loadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
    Calls loadDataElements(KNode, Predicate, boolean, IProperty...) with clearProperties set to false.
    static void
    loadDataElements(KNode graph, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
    Calls loadDataElements(KNode, boolean, IProperty...) with clearProperties set to false.
    static void
    setOption(org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value)
    Set a layout option using a serialized key / value pair.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREDICATE_IS_KLAYOUTDATA

      public static final com.google.common.base.Predicate<EMapPropertyHolder> PREDICATE_IS_KLAYOUTDATA
      A predicate returning true if the passed element is an instance of IPropertyHolder.
  • Method Details

    • setOption

      public static void setOption(org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value)
      Set a layout option using a serialized key / value pair.
      Parameters:
      propertyHolder - the property holder to modify
      id - the layout option identifier
      value - the value for the layout option
    • loadDataElements

      public static void loadDataElements(KNode graph, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
      Calls loadDataElements(KNode, boolean, IProperty...) with clearProperties set to false.
      Parameters:
      graph - the root element of the graph to load elements of.
      knownProps - a set of additional properties that are known, hence should be parsed properly
    • loadDataElements

      public static void loadDataElements(KNode graph, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
      Loads all IProperty of KLayoutData elements of a KGraph by deserializing PersistentEntry tuples. Values are parsed using layout option data obtained from the LayoutMetaDataService. Options that cannot be resolved immediately (e.g. because the extension points have not been read yet) are stored as LayoutOptionProxy.
      Parameters:
      graph - the root element of the graph to load elements of.
      clearProperties - true if the properties of a property holder should be cleared before repopulating them based on persistent entries. Required if the removal of a persistent entry should result in the removal of the correspondind property. This is for example the case in our Xtext-based KGT editor.
      knownProps - a set of additional properties that are known, hence should be parsed properly
    • loadDataElements

      public static KNode loadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
      Calls loadDataElements(KNode, Predicate, boolean, IProperty...) with clearProperties set to false.
      Parameters:
      graph - the root element of the graph to load elements of.
      handledTypes - a predicate checking if we desire to load data elements for a certain subclass of EMapPropertyHolder.
      knownProps - a set of additional properties that are known, hence should be parsed properly.
      Returns:
      the graph itself
    • loadDataElements

      public static KNode loadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps)
      Loads all IProperty of elements that pass the test performed by the handledTypes predicate of a KGraph by deserializing PersistentEntry tuples. Values are parsed using layout option data obtained from the LayoutMetaDataService. Options that cannot be resolved immediately (e.g. because the extension points have not been read yet) are stored as LayoutOptionProxy.
      Parameters:
      graph - the root element of the graph to load elements of.
      handledTypes - a predicate checking if we desire to load data elements for a certain subclass of EMapPropertyHolder.
      clearProperties - true if the properties of a property holder should be cleared before repopulating them based on persistent entries. Required if the removal of a persistent entry should result in the removal of the correspondind property. This is for example the case in our Xtext-based KGT editor.
      knownProps - a set of additional properties that are known, hence should be parsed properly.
      Returns:
      the graph itself
    • loadDataElement

      public static void loadDataElement(org.eclipse.elk.core.data.LayoutMetaDataService dataService, org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value)
      Configures the layout option given by key and value in the given IPropertyHolder, if key denominates a registered Layout Option; configures a LayoutOptionProxy otherwise.

      Extracted that part into a dedicated method in order to be able to re-use it, e.g. in KLighD's ExpansionAwareLayoutOptionData.
      Parameters:
      dataService - the current LayoutMetaDataService
      propertyHolder - the IPropertyHolder to be configured
      id - the layout option's id
      value - the desired option value
    • loadDataElement

      public static void loadDataElement(org.eclipse.elk.core.data.LayoutMetaDataService dataService, org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value, Map<String,? extends org.eclipse.elk.graph.properties.IProperty<?>> knownProps)
      Configures the layout option given by key and value in the given IPropertyHolder, if key denominates a registered Layout Option; configures a LayoutOptionProxy otherwise.

      Extracted that part into a dedicated method in order to be able to re-use it, e.g. in KLighD's ExpansionAwareLayoutOptionData.
      Parameters:
      dataService - the current LayoutMetaDataService
      propertyHolder - the IPropertyHolder to be configured
      id - the layout option's id
      value - the desired option value
      knownProps - a map with additional properties that are known, hence should be parsed properly. Only floats, integers, and boolean values can be parsed here.