use of org.eclipse.elk.graph.properties.MapPropertyHolder in project elk by eclipse.
the class LayoutConfigurator method overrideWith.
/**
* Copy all options from the given configurator to this one, possibly overriding the own options. The
* {@link IOptionFilter}s of this configurator are cleared and filled with the filters of {@code other}.
*
* @return {@code this}
*/
public LayoutConfigurator overrideWith(final LayoutConfigurator other) {
for (Map.Entry<ElkGraphElement, MapPropertyHolder> entry : other.elementOptionMap.entrySet()) {
MapPropertyHolder thisHolder = this.elementOptionMap.get(entry.getKey());
if (thisHolder == null) {
thisHolder = new MapPropertyHolder();
this.elementOptionMap.put(entry.getKey(), thisHolder);
}
thisHolder.copyProperties(entry.getValue());
}
for (Map.Entry<Class<? extends ElkGraphElement>, MapPropertyHolder> entry : other.classOptionMap.entrySet()) {
MapPropertyHolder thisHolder = this.classOptionMap.get(entry.getKey());
if (thisHolder == null) {
thisHolder = new MapPropertyHolder();
this.classOptionMap.put(entry.getKey(), thisHolder);
}
thisHolder.copyProperties(entry.getValue());
}
this.clearLayout = other.clearLayout;
this.optionFilters.clear();
this.optionFilters.addAll(other.optionFilters);
return this;
}
use of org.eclipse.elk.graph.properties.MapPropertyHolder in project elk by eclipse.
the class LayoutConfigurator method visit.
/**
* Apply this layout configurator to the given graph element.
*/
@Override
public void visit(final ElkGraphElement element) {
if (clearLayout) {
element.getProperties().clear();
}
MapPropertyHolder combined = findClassOptions(element);
// implicitly overwrite options specified for a class with options specified for the specific element
combined.copyProperties(getProperties(element));
applyProperties(element, combined);
}
use of org.eclipse.elk.graph.properties.MapPropertyHolder in project elk by eclipse.
the class LayoutConfigurator method configure.
/**
* Add and return a property holder for the given element. If such a property holder is
* already present, the previous instance is returned.
*/
public IPropertyHolder configure(final ElkGraphElement element) {
MapPropertyHolder result = elementOptionMap.get(element);
if (result == null) {
result = new MapPropertyHolder();
elementOptionMap.put(element, result);
}
return result;
}
Aggregations