package org.simantics.district.network.profile; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.profile.StyleBase; import org.simantics.scenegraph.INode; import org.simantics.scenegraph.g2d.nodes.SingleElementNode; import org.simantics.scenegraph.profile.EvaluationContext; /** * @author Tuukka Lehtonen */ public class HideStyle extends StyleBase { @Override public Boolean calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException { return Boolean.TRUE; } @Override public void applyStyleForNode(EvaluationContext observer, INode node, Boolean result) { SingleElementNode n = (SingleElementNode) node; n.setVisible(false); n.setHidden(true); } @Override protected void cleanupStyleForNode(EvaluationContext evaluationContext, INode node) { SingleElementNode n = (SingleElementNode) node; n.setVisible(true); n.setHidden(false); } @Override public String toString() { return "Hide"; } }