X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fprofile%2FVertexSymbolStyle.java;fp=org.simantics.district.network%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fnetwork%2Fprofile%2FVertexSymbolStyle.java;h=913ba201222bf705978d8abae418976475c7d935;hb=3730466cd1e90c50c988292e107639952448d6a6;hp=26a5564d5fade5e47180b437fd12b5c56f66032f;hpb=e6b35994e05232dd536af4da224a342c1bd090af;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java b/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java index 26a5564d..913ba201 100644 --- a/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java +++ b/org.simantics.district.network/src/org/simantics/district/network/profile/VertexSymbolStyle.java @@ -18,34 +18,39 @@ import org.simantics.scl.runtime.function.FunctionImpl1; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@Deprecated public class VertexSymbolStyle extends ThrottledStyleBase { private static final Logger LOGGER = LoggerFactory.getLogger(VertexSymbolStyle.class); - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public String calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException { - // Prevent PendingVariableExceptions from coming through - boolean wasSynchronous = graph.setSynchronous(true); - try { - Function symbolFunction = getSymbolFunction(graph, entry); - if (symbolFunction == null) - return null; - - try { - return (String) Simantics.applySCLRead(graph, symbolFunction, groupItem); - } catch (Exception e) { - LOGGER.error("Getting dynamic symbol for " + groupItem + " (" + graph.getPossibleRelatedValue(groupItem, Layer0.getInstance(graph).HasName) + ") failed", e); - return null; - } - } - finally { - graph.setSynchronous(wasSynchronous); - } - } + + @Override + public String calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException { + return calculateStyle(graph, entry, groupItem); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static String calculateStyle(ReadGraph graph, Resource entry, Resource groupItem) throws DatabaseException { + // Prevent PendingVariableExceptions from coming through + boolean wasSynchronous = graph.setSynchronous(true); + try { + Function symbolFunction = getSymbolFunction(graph, entry); + if (symbolFunction == null) + return null; + + try { + return (String) Simantics.applySCLRead(graph, symbolFunction, groupItem); + } catch (Exception e) { + LOGGER.error("Getting dynamic symbol for " + groupItem + " (" + + graph.getPossibleRelatedValue(groupItem, Layer0.getInstance(graph).HasName) + ") failed", e); + return null; + } + } finally { + graph.setSynchronous(wasSynchronous); + } + } @SuppressWarnings("rawtypes") - protected static Function getSymbolFunction(ReadGraph graph, Resource entry) throws DatabaseException { + public static Function getSymbolFunction(ReadGraph graph, Resource entry) throws DatabaseException { // Cache function read for profile entry return graph.syncRequest(new SymbolFunctionRequest(entry), TransientCacheListener.instance()); }