Class KGraphDataUtil
java.lang.Object
de.cau.cs.kieler.klighd.kgraph.util.KGraphDataUtil
Utilites for interacting with graphs based on metadata from the extension services.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA tree iterator that skips properties ofEMapPropertyHolders. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.base.Predicate<EMapPropertyHolder>A predicate returning true if the passed element is an instance ofIPropertyHolder. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidloadDataElement(org.eclipse.elk.core.data.LayoutMetaDataService dataService, org.eclipse.elk.graph.properties.IPropertyHolder propertyHolder, String id, String value) Configures thelayout optiongiven bykeyandvaluein the givenIPropertyHolder, ifkeydenominates a registered Layout Option; configures aLayoutOptionProxyotherwise.
Extracted that part into a dedicated method in order to be able to re-use it, e.g.static voidloadDataElement(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 thelayout optiongiven bykeyandvaluein the givenIPropertyHolder, ifkeydenominates a registered Layout Option; configures aLayoutOptionProxyotherwise.
Extracted that part into a dedicated method in order to be able to re-use it, e.g.static voidloadDataElements(KNode graph, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps) static KNodeloadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, boolean clearProperties, org.eclipse.elk.graph.properties.IProperty<?>... knownProps) Loads allIPropertyof elements that pass the test performed by thehandledTypespredicate of a KGraph by deserializingPersistentEntrytuples.static KNodeloadDataElements(KNode graph, com.google.common.base.Predicate<EMapPropertyHolder> handledTypes, org.eclipse.elk.graph.properties.IProperty<?>... knownProps) static voidloadDataElements(KNode graph, org.eclipse.elk.graph.properties.IProperty<?>... knownProps) static voidSet a layout option using a serialized key / value pair.
-
Field Details
-
PREDICATE_IS_KLAYOUTDATA
A predicate returning true if the passed element is an instance ofIPropertyHolder.
-
-
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 modifyid- the layout option identifiervalue- the value for the layout option
-
loadDataElements
public static void loadDataElements(KNode graph, org.eclipse.elk.graph.properties.IProperty<?>... knownProps) - 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 allIPropertyofKLayoutDataelements of a KGraph by deserializingPersistentEntrytuples. Values are parsed using layout option data obtained from theLayoutMetaDataService. Options that cannot be resolved immediately (e.g. because the extension points have not been read yet) are stored asLayoutOptionProxy.- Parameters:
graph- the root element of the graph to load elements of.clearProperties-trueif 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) - 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 ofEMapPropertyHolder.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 allIPropertyof elements that pass the test performed by thehandledTypespredicate of a KGraph by deserializingPersistentEntrytuples. Values are parsed using layout option data obtained from theLayoutMetaDataService. Options that cannot be resolved immediately (e.g. because the extension points have not been read yet) are stored asLayoutOptionProxy.- 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 ofEMapPropertyHolder.clearProperties-trueif 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 thelayout optiongiven bykeyandvaluein the givenIPropertyHolder, ifkeydenominates a registered Layout Option; configures aLayoutOptionProxyotherwise.
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 currentLayoutMetaDataServicepropertyHolder- theIPropertyHolderto be configuredid- the layout option's idvalue- 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 thelayout optiongiven bykeyandvaluein the givenIPropertyHolder, ifkeydenominates a registered Layout Option; configures aLayoutOptionProxyotherwise.
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 currentLayoutMetaDataServicepropertyHolder- theIPropertyHolderto be configuredid- the layout option's idvalue- the desired option valueknownProps- a map with additional properties that are known, hence should be parsed properly. Only floats, integers, and boolean values can be parsed here.
-