Search in sources :

Example 1 with KInvisibility

use of de.cau.cs.kieler.klighd.krendering.KInvisibility in project lingua-franca by lf-lang.

the class InterfaceDependenciesVisualization method updateInterfaceDependencyVisibility.

/**
 * Updates the visibility of interface dependencies edges based on the expansion state.
 */
public static void updateInterfaceDependencyVisibility(KNode node, boolean expanded) {
    Iterable<KEdge> edges = IterableExtensions.filter(node.getOutgoingEdges(), it -> {
        return it.getProperty(INTERFACE_DEPENDENCY);
    });
    Iterable<Iterable<KRendering>> renders = IterableExtensions.map(edges, (KEdge it) -> {
        return Iterables.<KRendering>filter(it.getData(), KRendering.class);
    });
    Iterables.concat(renders).forEach(it -> {
        KInvisibility inv = IterableExtensions.last(Iterables.filter(it.getStyles(), KInvisibility.class));
        if (inv == null) {
            inv = KRenderingFactory.eINSTANCE.createKInvisibility();
            it.getStyles().add(inv);
        }
        inv.setInvisible(expanded);
    });
}
Also used : KInvisibility(de.cau.cs.kieler.klighd.krendering.KInvisibility) KEdge(de.cau.cs.kieler.klighd.kgraph.KEdge) KRendering(de.cau.cs.kieler.klighd.krendering.KRendering)

Aggregations

KEdge (de.cau.cs.kieler.klighd.kgraph.KEdge)1 KInvisibility (de.cau.cs.kieler.klighd.krendering.KInvisibility)1 KRendering (de.cau.cs.kieler.klighd.krendering.KRendering)1